Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Supervisord does not start killed processes

Tags:

supervisord

I have supervisord installed on my Ubuntu 10.04 and it runs a Java process continuously and supposed to heal (reload) process when it somehow dies or crashes.

On my htop I send SIGKILL, SIGTERM, SIGHUP, SIGSEGV signals to that Java process and watch /etc/logs/supervisord.log file and it says.

08:09:46,182 INFO success: myprogram entered RUNNING state,[...]
08:38:10,043 INFO exited: myprogram (exit status 0; expected) 

At 08:38 I kill the process with SIGSEGV. How come it is exited with code 0 and why does not supervisord restart it at all?

All my supervisord.conf about this specific program is as follows:

[program:play-9000]
command=play run /var/www/myprogram/ --%%prod
stderr_logfile = /var/log/supervisord/myprogram-stderr.log
stdout_logfile = /var/log/supervisord/myprogram-stdout.log

Process works really fine when I launch supervisord, however does not get healed.

By the way any ideas how to start supervisord as a service so that it automatically launches when the whole system reboots?

like image 390
ahmet alp balkan Avatar asked Oct 26 '11 12:10

ahmet alp balkan


1 Answers

Try setting autorestart=true. By default, autorestart is set to "unexpected" which means it will only restart a process if it exits with an unexpected exit code. By default, exit code 0 is expected.

http://supervisord.org/configuration.html#program-x-section-settings

You can use the chkconfig program to make sure that supervisor starts on reboot.

$ sudo apt-get install chkconfig
$ chkconfig -l supervisor
supervisor                0:off  1:off  2:on   3:on   4:on   5:on   6:off

You can see that it's enabled for runlevels 2-5 by default when I installed it.

$ man 7 runlevel

for more info on run levels.

like image 50
Roger Hoover Avatar answered Sep 20 '22 06:09

Roger Hoover