Skip to content
Tim Allingham edited this page Mar 8, 2015 · 4 revisions

Upstart

I encountered some issues with running hypnotoad via upstart - Upstart would constantly be re-calling the start command due to the Fork shifting process ID's, and upstart losing track of the running process.

To avoid this, the following can be used - executing hypnotoad with -f will keep the manager running in the foreground for upstart to monitor correctly. Setuid should also be used to switch to an unprivileged user first.

After creating the file, run initctl reload-configuration to pick it up with upstart.

Because we are keeping the manager in the foreground, running hypnotoad manually after an app update for a hot deployment will not break the upstart process - status, stop and restart will all still work correctly

###########################################
##### name file as [% appname %].conf #####
##### install in /etc/init            #####
###########################################
description "[% App description %]"

setuid [% appuser %]

start on runlevel [2345]
stop on runlevel [!2345]

exec /usr/local/bin/hypnotoad -f [% path_to_app %]/script/[% appname %]

pre-stop exec /usr/local/bin/hypnotoad -s [% path_to_app %]/script/[% appname %]


normal exit 0 1 TERM HUP
Clone this wiki locally