I am trying to write an upstart script that checks if my process is running by pinging it's HTTP interface. So far, I just can't get the post-start
clause to work. Here's a simplified version that I've tried:
description "my application"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 360 180
setuid myuser
setgid mygroup
chdir /my/directory
exec /bin/sleep 60
post-start script
sleep 5
stop
exit 1
end script
From terminal:
/etc/init$ sudo start myapp # returns after 5 seconds
myapp start/running, process 27477
jrantil@myserver:/etc/init$ ps -ef|grep sleep
107 27477 1 0 16:56 ? 00:00:00 /bin/sleep 60
jrantil 27482 26900 0 16:56 pts/1 00:00:00 grep --color=auto sleep
Could anyone tell me why my application is not shutting down after 5 seconds? As far as I've understood, if I don't call stop
it will simply respawn.