#! /bin/sh # $Id$ # $URL$ ### BEGIN INIT INFO # Provides: bzv # Required-Start: $syslog $named $network $time # Required-Stop: $syslog $named $network $time # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start bzv daemon # Description: Beter Zoeken & Vinden server ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin NAME=bzv DESC='BZV daemon' DAEMON=/usr/bin/meresco-server.py CONFIG=/etc/bzv PYTHON=/usr/bin/python2.5 USER=bzv test -x $DAEMON || exit 0 test -e $CONFIG || exit 0 mkdir -p /var/run/bzv export LANG=en_US.UTF-8 # Include bzv defaults if available if [ -f /etc/default/bzv ] then . /etc/default/bzv fi command=$1 shift instances=$* instances() { case $instances in '') for c in $CONFIG/*.cfg do base=${c##*/} test -f "$c" && echo ${base%.cfg} done ;; *) echo "$instances" esac } servertype() { t= while read -r line do read -r key val </dev/null } case $command in start) echo -n "Starting $DESC:" done=' (none)' for i in $(instances) do done=. start $i echo -n " $i" done echo $done ;; stop) echo -n "Stopping $DESC:" done=' (none)' for i in $(instances) do done=. stop $i echo -n " $i" done echo $done ;; force-reload) # If the "reload" option is implemented, move the "force-reload" # option to the "reload" entry above. If not, "force-reload" is # just the same as "restart" except that it does nothing if the # daemon isn't already running. # check wether $DAEMON is running. If so, restart echo -n "Force-reloading $DESC:" done=' (none)' for i in $(instances) do if isrunning $i then done=. stop $i echo -n " $i" sleep 1 start $i fi done echo $done ;; restart) echo -n "Restarting $DESC:" done=' (none)' for i in $(instances) do done=. echo -n " $i" if isrunning $i then stop $i sleep 1 fi start $i done echo $done ;; status) for i in $(instances) do if ! isrunning $i then exit 1 fi done exit 0 ;; *) echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2 exit 1 ;; esac exit 0