From 207594c7cdb3f917498132e378da24be692d9308 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 23 Feb 2011 13:25:57 +0100 Subject: [PATCH] cleanup init.d --- etc/init.d/pandora | 12 ++++++------ etc/init.d/pandora-encoding | 7 +++---- etc/init.d/pandora-tasks | 5 ++--- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/etc/init.d/pandora b/etc/init.d/pandora index 1c51319d4..50a6b1194 100755 --- a/etc/init.d/pandora +++ b/etc/init.d/pandora @@ -19,7 +19,7 @@ PANDORA_BASE=/srv/pandora DAEMON_USER="pandora" DAEMON_NAME=bin/gunicorn_django 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 SCRIPTNAME=/etc/init.d/$NAME @@ -46,11 +46,12 @@ do_start() # 0 if daemon has been started # 1 if daemon was already running # 2 if daemon could not be started - killall oxframe - start-stop-daemon --start --quiet --pidfile $PIDFILE -c $DAEMON_USER \ + 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 \ --exec $DAEMON --test > /dev/null \ || 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 \ || return 2 } @@ -65,8 +66,7 @@ do_stop() # 1 if daemon was already stopped # 2 if daemon could not be stopped # other if a failure occurred - start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE \ - -c $DAEMON_USER --name $DAEMON_NAME + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE RETVAL="$?" [ "$RETVAL" = 2 ] && return 2 # Wait for children to finish too if this is a daemon that forks diff --git a/etc/init.d/pandora-encoding b/etc/init.d/pandora-encoding index c0cb66b7b..e608e7f27 100755 --- a/etc/init.d/pandora-encoding +++ b/etc/init.d/pandora-encoding @@ -46,11 +46,11 @@ do_start() # 0 if daemon has been started # 1 if daemon was already running # 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 \ --exec $DAEMON --test > /dev/null \ || 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 \ || return 2 } @@ -65,8 +65,7 @@ do_stop() # 1 if daemon was already stopped # 2 if daemon could not be stopped # other if a failure occurred - start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE \ - -c $DAEMON_USER --name $DAEMON_NAME + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE RETVAL="$?" [ "$RETVAL" = 2 ] && return 2 # Wait for children to finish too if this is a daemon that forks diff --git a/etc/init.d/pandora-tasks b/etc/init.d/pandora-tasks index 5f00966ee..564fee47d 100755 --- a/etc/init.d/pandora-tasks +++ b/etc/init.d/pandora-tasks @@ -46,7 +46,7 @@ do_start() # 0 if daemon has been started # 1 if daemon was already running # 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 \ --exec $DAEMON --test > /dev/null \ || return 1 @@ -65,8 +65,7 @@ do_stop() # 1 if daemon was already stopped # 2 if daemon could not be stopped # other if a failure occurred - start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE \ - -c $DAEMON_USER --name $DAEMON_NAME + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE RETVAL="$?" [ "$RETVAL" = 2 ] && return 2 # Wait for children to finish too if this is a daemon that forks