#!/sbin/runscript # Copyright 1999-2002 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License, v2 or later caudiumhome=/usr/lib/caudium daemon=${caudiumhome}/start-caudium name="Caudium" pidfile=/var/run/caudium/caudium.pid flags="--pid-file=${pidfile} --config-dir=/etc/caudium/servers/ --log-dir=/var/log/caudium/ ${flags}" depend () { need net } start () { ebegin "Starting ${name}" cd ${caudiumhome} ${daemon} ${flags} # start-stop-daemon --start --quiet --pidfile ${pidfile} --exec ${daemon} -- --pid-file=${pidfile} ${flags} eend $? } stop () { ebegin "Stopping ${name}" # if [ ! -f ${pidfile} ] # then # echo "${name} not running" # exit 0 # fi for p in `cat ${pidfile}` do if [ -n "`ps -p $p --no-headers`" ] then kill -TERM $p > /dev/null || true fi done rm -f ${pidfile} # start-stop-daemon --stop --quiet --exec ${daemon} # killall caudium # start-stop-daemon --stop --quiet --pidfile ${pidfile} eend $? } reload () { if [ -f ${pidfile} ] then echo -n "Restarting ${name}: " for p in `cat ${pidfile} | sed -e 1d` do if [ -n "`ps -p $p --no-headers`" ] then kill -HUP $p > /dev/null || true fi done else echo "No pidfile found. Cannot reload." fi eend $? }