From 470a6fcf1e27e47fefd74ab7b7d1a071f0e5c885 Mon Sep 17 00:00:00 2001 From: realraum Date: Thu, 10 Sep 2009 01:34:19 +0000 Subject: [PATCH] renamed initscript initscript now starts/stops update_web_status.py as well --- tuer | 67 ------------------------------------------------- tuer.initscript | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 67 deletions(-) delete mode 100755 tuer create mode 100755 tuer.initscript diff --git a/tuer b/tuer deleted file mode 100755 index 46e9463..0000000 --- a/tuer +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh -# Start/stop the tuer daemon. -# -### BEGIN INIT INFO -# Provides: tuer -# Required-Start: $remote_fs $syslog $time -# Required-Stop: $remote_fs $syslog $time -# Default-Start: 2 3 4 5 -# Default-Stop: 1 -### END INIT INFO - -EXE_DOOR=/flash/tuer/door_daemon -EXE_CARD=/flash/tuer/checkcard.pl -DIR_RUN=/var/run/tuer - -DOOR_SOCKET=${DIR_RUN}/door_cmd.socket -DOOR_DEV=/dev/door -#DOOR_LOG=/var/log/tmp/tuer.log -DOOR_USR=tuer -DOOR_GRP=nogroup -#DOOR_HOME=$DIR_RUN - -PIDFILE1=${DIR_RUN}/door_daemon.pid -PIDFILE2=${DIR_RUN}/checkcard.pid - -test -f $EXE_DOOR || exit 1 -test -f $EXE_CARD || exit 1 -if [ ! -d $DIR_RUN ]; then - mkdir -p $DIR_RUN || exit 2 - chown -R $DOOR_USR:$DOOR_GRP $DIR_RUN -fi -chown $DOOR_USR:$DOOR_GRP $DOOR_DEV - -. /lib/lsb/init-functions - -# Read the system's locale and set cron's locale. This locale -# will be inherited by cron (used to set charset of emails) -# and tasks running under it. - -case "$1" in -start) - log_daemon_msg "Starting door daemon" "door_daemon" - start-stop-daemon --start --quiet --pidfile $PIDFILE1 --name door_daemon --startas $EXE_DOOR -- -d $DOOR_DEV -s $DOOR_SOCKET -u $DOOR_USR -g $DOOR_GRP -P $PIDFILE1 - log_end_msg $? - log_daemon_msg "Starting door daemon" "checkcard" - start-stop-daemon --start --quiet --pidfile $PIDFILE2 -b -m --name checkcard.pl --startas $EXE_CARD -- $DOOR_SOCKET - #start-stop-daemon --start --quiet --pidfile $PIDFILE2 -c $DOOR_USR -b -m --name checkcard.pl --startas $EXE_CARD -- $DOOR_SOCKET - log_end_msg $? - ;; -stop) - log_daemon_msg "Stopping door daemon" "door_daemon" - start-stop-daemon --stop --quiet --pidfile $PIDFILE1 -m --name door_daemon - log_end_msg $? - log_daemon_msg "Stopping door daemon" "checkcard" - start-stop-daemon --stop --quiet --pidfile $PIDFILE2 -m --name checkcard.pl - log_end_msg $? - killall "mifare-read" 2>/dev/null - ;; -restart) - $0 stop - $0 start - ;; -*) log_action_msg "Usage: $0 {start|stop|restart|reload|force-reload}" - exit 2 - ;; -esac -exit 0 diff --git a/tuer.initscript b/tuer.initscript new file mode 100755 index 0000000..b07346a --- /dev/null +++ b/tuer.initscript @@ -0,0 +1,75 @@ +#!/bin/sh +# Start/stop the tuer daemon. +# +### BEGIN INIT INFO +# Provides: tuer +# Required-Start: $remote_fs $syslog $time +# Required-Stop: $remote_fs $syslog $time +# Default-Start: 2 3 4 5 +# Default-Stop: 1 +### END INIT INFO + +EXE_DOOR=/flash/tuer/door_daemon +EXE_CARD=/flash/tuer/checkcard.pl +EXE_UWEB=/flash/tuer/update_web_status.py +DIR_RUN=/var/run/tuer + +DOOR_SOCKET=${DIR_RUN}/door_cmd.socket +DOOR_DEV=/dev/door +#DOOR_LOG=/var/log/tmp/tuer.log +DOOR_USR=tuer +DOOR_GRP=nogroup +#DOOR_HOME=$DIR_RUN + +PIDFILE1=${DIR_RUN}/door_daemon.pid +PIDFILE2=${DIR_RUN}/checkcard.pid +PIDFILE3=${DIR_RUN}/update_web_status.pid + +test -f $EXE_DOOR || exit 1 +test -f $EXE_CARD || exit 1 +if [ ! -d $DIR_RUN ]; then + mkdir -p $DIR_RUN || exit 2 + chown -R $DOOR_USR:$DOOR_GRP $DIR_RUN +fi +chown $DOOR_USR:$DOOR_GRP $DOOR_DEV + +. /lib/lsb/init-functions + +# Read the system's locale and set cron's locale. This locale +# will be inherited by cron (used to set charset of emails) +# and tasks running under it. + +case "$1" in +start) + log_daemon_msg "Starting door daemon" "door_daemon" + start-stop-daemon --start --quiet --pidfile $PIDFILE1 --name door_daemon --startas $EXE_DOOR -- -d $DOOR_DEV -s $DOOR_SOCKET -u $DOOR_USR -g $DOOR_GRP -P $PIDFILE1 + log_end_msg $? + log_daemon_msg "Starting door daemon" "checkcard" + start-stop-daemon --start --quiet --pidfile $PIDFILE2 -b -m --name checkcard.pl --startas $EXE_CARD -- $DOOR_SOCKET + #start-stop-daemon --start --quiet --pidfile $PIDFILE2 -c $DOOR_USR -b -m --name checkcard.pl --startas $EXE_CARD -- $DOOR_SOCKET + log_end_msg $? + log_daemon_msg "Starting door daemon" "update_web_status" + start-stop-daemon --start --quiet --pidfile $PIDFILE3 -b -m -c $DOOR_USR --name update_web_status.py --startas $EXE_UWEB -- $DOOR_SOCKET + log_end_msg $? + ;; +stop) + log_daemon_msg "Stopping door daemon" "door_daemon" + start-stop-daemon --stop --quiet --pidfile $PIDFILE1 -m --name door_daemon + log_end_msg $? + log_daemon_msg "Stopping door daemon" "checkcard" + start-stop-daemon --stop --quiet --pidfile $PIDFILE2 -m --name checkcard.pl + log_end_msg $? + log_daemon_msg "Stopping door daemon" "update_web_status" + start-stop-daemon --stop --quiet --pidfile $PIDFILE3 -m --name update_web_status.py + log_end_msg $? + killall "mifare-read" 2>/dev/null + ;; +restart) + $0 stop + $0 start + ;; +*) log_action_msg "Usage: $0 {start|stop|restart|reload|force-reload}" + exit 2 + ;; +esac +exit 0 -- 1.7.10.4