cleanup init.d
This commit is contained in:
parent
bd258ad855
commit
7c74cd8b01
3 changed files with 11 additions and 13 deletions
|
@ -19,7 +19,7 @@ PANDORA_BASE=/srv/pandora
|
||||||
DAEMON_USER="pandora"
|
DAEMON_USER="pandora"
|
||||||
DAEMON_NAME=bin/gunicorn_django
|
DAEMON_NAME=bin/gunicorn_django
|
||||||
DAEMON="$PANDORA_BASE/$DAEMON_NAME"
|
DAEMON="$PANDORA_BASE/$DAEMON_NAME"
|
||||||
DAEMON_ARGS="--bind 127.0.0.1:2620 --timeout 90 --log-level info --log-file /var/log/pandora/pandora.log --workers 5 $PANDORA_BASE/pandora.settings.py"
|
DAEMON_ARGS="--bind 127.0.0.1:2620 --timeout 90 --log-level info --log-file /var/log/pandora/pandora.log --workers 5 $PANDORA_BASE/pandora/settings.py"
|
||||||
PIDFILE=/var/run/$NAME.pid
|
PIDFILE=/var/run/$NAME.pid
|
||||||
SCRIPTNAME=/etc/init.d/$NAME
|
SCRIPTNAME=/etc/init.d/$NAME
|
||||||
|
|
||||||
|
@ -46,11 +46,12 @@ do_start()
|
||||||
# 0 if daemon has been started
|
# 0 if daemon has been started
|
||||||
# 1 if daemon was already running
|
# 1 if daemon was already running
|
||||||
# 2 if daemon could not be started
|
# 2 if daemon could not be started
|
||||||
killall oxframe
|
test -e /var/log/pandora || (mkdir -p /var/log/pandora && chown $DAEMON_USER:$DAEMON_USER /var/log/pandora)
|
||||||
|
|
||||||
start-stop-daemon --start --quiet --pidfile $PIDFILE -c $DAEMON_USER \
|
start-stop-daemon --start --quiet --pidfile $PIDFILE -c $DAEMON_USER \
|
||||||
--exec $DAEMON --test > /dev/null \
|
--exec $DAEMON --test > /dev/null \
|
||||||
|| return 1
|
|| return 1
|
||||||
start-stop-daemon --start --quiet --pidfile $PIDFILE -c $DAEMON_USER \
|
start-stop-daemon --start --quiet --pidfile $PIDFILE -c $DAEMON_USER --startas $DAEMON \
|
||||||
--make-pidfile --background --exec $DAEMON -- $DAEMON_ARGS \
|
--make-pidfile --background --exec $DAEMON -- $DAEMON_ARGS \
|
||||||
|| return 2
|
|| return 2
|
||||||
}
|
}
|
||||||
|
@ -65,8 +66,7 @@ do_stop()
|
||||||
# 1 if daemon was already stopped
|
# 1 if daemon was already stopped
|
||||||
# 2 if daemon could not be stopped
|
# 2 if daemon could not be stopped
|
||||||
# other if a failure occurred
|
# other if a failure occurred
|
||||||
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE \
|
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
|
||||||
-c $DAEMON_USER --name $DAEMON_NAME
|
|
||||||
RETVAL="$?"
|
RETVAL="$?"
|
||||||
[ "$RETVAL" = 2 ] && return 2
|
[ "$RETVAL" = 2 ] && return 2
|
||||||
# Wait for children to finish too if this is a daemon that forks
|
# Wait for children to finish too if this is a daemon that forks
|
||||||
|
|
|
@ -46,11 +46,11 @@ do_start()
|
||||||
# 0 if daemon has been started
|
# 0 if daemon has been started
|
||||||
# 1 if daemon was already running
|
# 1 if daemon was already running
|
||||||
# 2 if daemon could not be started
|
# 2 if daemon could not be started
|
||||||
killall oxframe
|
test -e /var/log/pandora || (mkdir -p /var/log/pandora && chown $DAEMON_USER:$DAEMON_USER /var/log/pandora)
|
||||||
start-stop-daemon --start --quiet --pidfile $PIDFILE -c $DAEMON_USER \
|
start-stop-daemon --start --quiet --pidfile $PIDFILE -c $DAEMON_USER \
|
||||||
--exec $DAEMON --test > /dev/null \
|
--exec $DAEMON --test > /dev/null \
|
||||||
|| return 1
|
|| return 1
|
||||||
start-stop-daemon --start --quiet --pidfile $PIDFILE -c $DAEMON_USER \
|
start-stop-daemon --start --quiet --pidfile $PIDFILE -c $DAEMON_USER -startas $DAEMON \
|
||||||
--make-pidfile --background --exec $DAEMON -- $DAEMON_ARGS \
|
--make-pidfile --background --exec $DAEMON -- $DAEMON_ARGS \
|
||||||
|| return 2
|
|| return 2
|
||||||
}
|
}
|
||||||
|
@ -65,8 +65,7 @@ do_stop()
|
||||||
# 1 if daemon was already stopped
|
# 1 if daemon was already stopped
|
||||||
# 2 if daemon could not be stopped
|
# 2 if daemon could not be stopped
|
||||||
# other if a failure occurred
|
# other if a failure occurred
|
||||||
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE \
|
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
|
||||||
-c $DAEMON_USER --name $DAEMON_NAME
|
|
||||||
RETVAL="$?"
|
RETVAL="$?"
|
||||||
[ "$RETVAL" = 2 ] && return 2
|
[ "$RETVAL" = 2 ] && return 2
|
||||||
# Wait for children to finish too if this is a daemon that forks
|
# Wait for children to finish too if this is a daemon that forks
|
||||||
|
|
|
@ -46,7 +46,7 @@ do_start()
|
||||||
# 0 if daemon has been started
|
# 0 if daemon has been started
|
||||||
# 1 if daemon was already running
|
# 1 if daemon was already running
|
||||||
# 2 if daemon could not be started
|
# 2 if daemon could not be started
|
||||||
killall oxframe
|
test -e /var/log/pandora || (mkdir -p /var/log/pandora && chown $DAEMON_USER:$DAEMON_USER /var/log/pandora)
|
||||||
start-stop-daemon --start --quiet --pidfile $PIDFILE -c $DAEMON_USER \
|
start-stop-daemon --start --quiet --pidfile $PIDFILE -c $DAEMON_USER \
|
||||||
--exec $DAEMON --test > /dev/null \
|
--exec $DAEMON --test > /dev/null \
|
||||||
|| return 1
|
|| return 1
|
||||||
|
@ -65,8 +65,7 @@ do_stop()
|
||||||
# 1 if daemon was already stopped
|
# 1 if daemon was already stopped
|
||||||
# 2 if daemon could not be stopped
|
# 2 if daemon could not be stopped
|
||||||
# other if a failure occurred
|
# other if a failure occurred
|
||||||
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE \
|
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
|
||||||
-c $DAEMON_USER --name $DAEMON_NAME
|
|
||||||
RETVAL="$?"
|
RETVAL="$?"
|
||||||
[ "$RETVAL" = 2 ] && return 2
|
[ "$RETVAL" = 2 ] && return 2
|
||||||
# Wait for children to finish too if this is a daemon that forks
|
# Wait for children to finish too if this is a daemon that forks
|
||||||
|
|
Loading…
Reference in a new issue