From ef9b24a9235e41cd911148188b8c59c860794b0c Mon Sep 17 00:00:00 2001 From: "David Adam (zanchey)" Date: Thu, 15 Oct 2009 21:58:47 +0800 Subject: [PATCH] initscript: added sample init.d script --- initscript | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 initscript diff --git a/initscript b/initscript new file mode 100755 index 0000000..b6a2c7c --- /dev/null +++ b/initscript @@ -0,0 +1,40 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: uccdoors +# Required-Start: $all +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start UCC door monitors at boot time +# Description: Enable UCC door hardware monitor and XMPP client. +### END INIT INFO + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DESC="UCC door monitors" +NAME=uccdoors +BASEDIR=/home/ucc/door/uccdoor + +case "$1" in + start) + echo -n "Starting $DESC:" + echo -n " server"; start-stop-daemon --start --quiet --chuid door --background --pidfile /var/run/door-server.pid --make-pidfile --startas $BASEDIR/server.py + sleep 5 + echo -n " client-xmpp"; start-stop-daemon --start --quiet --chuid door --background --pidfile /var/run/door-client-xmpp.pid --make-pidfile --startas $BASEDIR/client-xmpp.py + echo "." + ;; + stop) + echo -n "Stopping $DESC:" + echo -n " client-xmpp"; start-stop-daemon --stop --quiet --pidfile /var/run/door-client-xmpp.pid $BASEDIR/client-xmpp.py + sleep 2 + echo -n " server"; start-stop-daemon --stop --quiet --pidfile /var/run/door-server.pid $BASEDIR/server.py + echo "." + ;; + restart|force-reload) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac -- 2.20.1