I'm using Upstart 1.5 in Ubuntu 12.04 to manage a process created by some user but needs to be managed as system job as starting on boot, respawning if it fails and we been able to start/stop it at any desired time so, I create it's .conf file in /etc/init and is as follows :
description "Start face services recognition and monitors it" version "1.0" start on runlevel stop on runlevel respawn expect fork normal exit 0 TERM STOP script exec sh -c /home/verstand/facefeatures end script post-stop script if [ ! $EXIT_STATUS && ! $EXIT_SIGNAL ] then exec sudo -u $USER "/sbin/shutdown -r now" fi end script
The signals here are intented to reboot the system in an emergency case where Upstart fails to respawn the process.
Now, the problem is when we start the process it runs fine, with
sudo initctl start facefeatures but when we try to stop it, it hangs and we need to use Ctl+C to return tty control.
Even more, if we try to start it again or restart it, Upstart reports it's already running:
start/running facefeatures but, if we use
initctl list Upstart reports as if the process was killed:
Also, if we reboot the first time it runs the process normally but if we reboot a second time it does it no more...
What is the problem of my conf file? What is the correct way of doing this?