#!/bin/sh # Start/stop the tuer status updater. # ### BEGIN INIT INFO # Provides: tuer_status # Required-Start: $remote_fs $syslog $time tuer_core tuer_presence # Required-Stop: $remote_fs $syslog $time tuer_core tuer_presence # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 ### END INIT INFO EXE_UWEB=/flash/tuer/r3-netstatus STATE_DIR=/flash/var/lib/r3netstatus/ CFG_UWEB="-syslog" . /etc/default/tuer [ -n "$XMPPJID" ] && CFG_UWEB="$CFG_UWEB --xjid $XMPPJID" [ -n "$XMPPPASS" ] && CFG_UWEB="$CFG_UWEB --xpass $XMPPPASS" [ -n "$XMPPBOTAUTH" ] && CFG_UWEB="$CFG_UWEB --xbotauth $XMPPBOTAUTH" PIDFILE_UWEB=${DIR_RUN}/r3-netstatus.pid test -f $EXE_UWEB || exit 1 if [ ! -d $DIR_RUN ]; then mkdir -p $DIR_RUN || exit 2 chown -R $DOOR_USR:$DOOR_GRP $DIR_RUN fi if [ ! -d $STATE_DIR ]; then mkdir -p $STATE_DIR || exit 2 chown -R $DOOR_USR:$DOOR_GRP $STATE_DIR fi . /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 xmpp and web status daemon" r3-netstatus start-stop-daemon --start --quiet --pidfile $PIDFILE_UWEB -b -m -c $DOOR_USR --startas $EXE_UWEB -- $CFG_UWEB log_end_msg $? ;; stop) log_daemon_msg "Stopping xmpp and web status daemon" r3-netstatus start-stop-daemon --stop --quiet --pidfile $PIDFILE_UWEB -m --retry TERM/1/TERM/1/KILL log_end_msg $? ;; restart) $0 stop $0 start ;; *) log_action_msg "Usage: $0 {start|stop|restart|reload|force-reload}" exit 2 ;; esac exit 0