Skip to content
This repository has been archived by the owner on Oct 15, 2019. It is now read-only.

Fixed init script issues #70

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@
default['supervisor']['minfds'] = 1024
default['supervisor']['minprocs'] = 200
default['supervisor']['socket_file'] = '/var/run/supervisor.sock'
default['supervisor']['init_script']['stop_wait_secs'] = 10
default['supervisor']['ctlplugins'] = {}
18 changes: 12 additions & 6 deletions templates/default/debian/supervisor.init.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ test -x $DAEMON || exit 0

LOGDIR=/var/log/supervisor
PIDFILE=/var/run/$NAME.pid
DODTIME=5 # Time to wait for the server to die, in seconds
# If this value is set too low you might not
# let some servers to die gracefully and
# 'restart' will not work

# Time to wait for the server to die, in seconds
# If this value is set too low you might not
# let some servers to die gracefully and
# 'restart' will not work

DODTIME=<%= node['supervisor']['init_script']['stop_wait_secs'] %>

# Include supervisor defaults if available
if [ -f /etc/default/supervisor ] ; then
Expand Down Expand Up @@ -79,7 +82,7 @@ force_stop() {
kill -9 $pid
[ -n "$DODTIME" ] && sleep "$DODTIME"s
if running ; then
echo "Cannot kill $LABEL (pid=$pid)!"
echo "Cannot kill $NAME (pid=$pid)!"
exit 1
fi
fi
Expand Down Expand Up @@ -142,12 +145,15 @@ case "$1" in
echo -n "Restarting $DESC: "
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
[ -n "$DODTIME" ] && sleep $DODTIME
if running ; then
force_stop
fi
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--startas $DAEMON -- $DAEMON_OPTS
echo "$NAME."
;;
status)
echo -n "$LABEL is "
echo -n "$NAME is "
if running ; then
echo "running"
else
Expand Down