diff --git a/deployment/puppet/nailgun/files/supervisor-init b/deployment/puppet/nailgun/files/supervisor-init index fe2d898989..2a21c48668 100755 --- a/deployment/puppet/nailgun/files/supervisor-init +++ b/deployment/puppet/nailgun/files/supervisor-init @@ -25,26 +25,24 @@ RETVAL=0 start() { - echo "Starting supervisord: " - if [ -e $PIDFILE ]; then - echo "ALREADY STARTED" - return 1 - fi + echo "Starting supervisord: " + if [ -e $PIDFILE ] && supervisor_status; then + echo "ALREADY STARTED" + return 1 + fi - # start supervisord with options from sysconfig (stuff like -c) - /usr/bin/supervisord $OPTIONS - - # show initial startup status - /usr/bin/supervisorctl $OPTIONS status - - # only create the subsyslock if we created the PIDFILE - [ -e $PIDFILE ] && touch /var/lock/subsys/supervisord + # start supervisord with options from sysconfig (stuff like -c) + /usr/bin/supervisord $OPTIONS + # show initial startup status + /usr/bin/supervisorctl $OPTIONS status + # only create the subsyslock if we created the PIDFILE + [ -e $PIDFILE ] && touch /var/lock/subsys/supervisord } stop() { echo -n "Stopping supervisord: " /usr/bin/supervisorctl $OPTIONS shutdown - if [ -n "$WAIT_FOR_SUBPROCESSES" ]; then + if [ -n "$WAIT_FOR_SUBPROCESSES" ]; then echo "Waiting roughly 60 seconds for $PIDFILE to be removed after child processes exit" for sleep in 2 2 2 2 4 4 4 4 8 8 8 8 last; do if [ ! -e $PIDFILE ] ; then @@ -72,6 +70,10 @@ restart() { start } +supervisor_status() { + /usr/bin/supervisorctl status && kill -s 0 `cat /var/run/supervisord.pid` 2>/dev/null + return $? +} case "$1" in start) start @@ -94,7 +96,7 @@ case "$1" in RETVAL=$? ;; status) - /usr/bin/supervisorctl status && kill -s 0 `cat /var/run/supervisord.pid` 2>/dev/null + supervisor_status RETVAL=$? ;; *) diff --git a/deployment/puppet/nailgun/templates/supervisor/ostf.conf.erb b/deployment/puppet/nailgun/templates/supervisor/ostf.conf.erb index 8ff8f68ea4..3705cf0710 100644 --- a/deployment/puppet/nailgun/templates/supervisor/ostf.conf.erb +++ b/deployment/puppet/nailgun/templates/supervisor/ostf.conf.erb @@ -9,7 +9,7 @@ startsecs=10 startretries=1000000 exitcodes=0,2 stopsignal=INT -stopwaitsecs=60 +stopwaitsecs=5 redirect_stderr=true stdout_logfile=/var/log/ostf-stdout.log stdout_logfile_maxbytes=50MB diff --git a/deployment/puppet/nailgun/templates/supervisord.conf.astute.erb b/deployment/puppet/nailgun/templates/supervisord.conf.astute.erb index e7c650bb7d..331de8c55a 100644 --- a/deployment/puppet/nailgun/templates/supervisord.conf.astute.erb +++ b/deployment/puppet/nailgun/templates/supervisord.conf.astute.erb @@ -26,7 +26,7 @@ startretries=1000000 exitcodes=0,2 stopsignal=KILL killasgroup=true -stopwaitsecs=60 +stopwaitsecs=5 redirect_stderr=true stdout_logfile=/var/log/astute/app.log stdout_logfile_maxbytes=50MB diff --git a/deployment/puppet/nailgun/templates/supervisord.conf.erb b/deployment/puppet/nailgun/templates/supervisord.conf.erb index 149cf69abf..da59082b5e 100644 --- a/deployment/puppet/nailgun/templates/supervisord.conf.erb +++ b/deployment/puppet/nailgun/templates/supervisord.conf.erb @@ -28,7 +28,7 @@ startsecs=10 startretries=1000000 exitcodes=0,2 stopsignal=INT -stopwaitsecs=60 +stopwaitsecs=5 redirect_stderr=true stdout_logfile=/var/log/nailgun/uwsgi.log stdout_capture_maxbytes=0 @@ -46,7 +46,7 @@ startsecs=10 startretries=1000000 exitcodes=0 stopsignal=INT -stopwaitsecs=60 +stopwaitsecs=5 redirect_stderr=true stdout_logfile=/var/log/nailgun/assassind.log stdout_capture_maxbytes=0 @@ -64,7 +64,7 @@ startsecs=10 startretries=1000000 exitcodes=0 stopsignal=INT -stopwaitsecs=60 +stopwaitsecs=5 redirect_stderr=true stdout_logfile=/var/log/nailgun/receiverd.log stdout_capture_maxbytes=0 @@ -82,7 +82,7 @@ startsecs=10 startretries=1000000 exitcodes=0,2 stopsignal=INT -stopwaitsecs=60 +stopwaitsecs=5 redirect_stderr=true stdout_logfile=/var/log/astute/app.log stdout_logfile_maxbytes=50MB diff --git a/deployment/puppet/nailgun/templates/supervisord.conf.nailgun.erb b/deployment/puppet/nailgun/templates/supervisord.conf.nailgun.erb index 2626210f5e..a04b81f56b 100644 --- a/deployment/puppet/nailgun/templates/supervisord.conf.nailgun.erb +++ b/deployment/puppet/nailgun/templates/supervisord.conf.nailgun.erb @@ -26,7 +26,7 @@ startsecs=10 startretries=1000000 exitcodes=0,2 stopsignal=INT -stopwaitsecs=60 +stopwaitsecs=5 redirect_stderr=true stdout_logfile=/var/log/nailgun/uwsgi.log stdout_capture_maxbytes=0 @@ -44,7 +44,7 @@ startsecs=10 startretries=1000000 exitcodes=0 stopsignal=INT -stopwaitsecs=60 +stopwaitsecs=5 redirect_stderr=true stdout_logfile=/var/log/nailgun/assassind.log stdout_capture_maxbytes=0 @@ -62,7 +62,7 @@ startsecs=10 startretries=1000000 exitcodes=0 stopsignal=INT -stopwaitsecs=60 +stopwaitsecs=5 redirect_stderr=true stdout_logfile=/var/log/nailgun/receiverd.log stdout_capture_maxbytes=0