#!/bin/bash # # /etc/init.d/Daemon # # Starts the at daemon # # chkconfig: 345 95 5 # description: Runs the demonstration daemon. # processname: Daemon # Source function library. . /etc/init.d/functions #startup values log=/var/log/qlog.log #verify that the executable exists test -x /var/lib/asterisk/scripts/qlog/qlogd.php || exit 0RETVAL=0 # # Set prog, proc and bin variables. # prog="qlog" proc=/var/lock/subsys/qlog bin=/var/lib/asterisk/scripts/qlog/qlogd.php start() { # Check if Daemon is already running if [ ! -f $proc ]; then echo -n $"Starting $prog: " daemon $bin --log=$log RETVAL=$? [ $RETVAL -eq 0 ] && touch $proc echo fi return $RETVAL } stop() { echo -n $"Stopping $prog: " killproc $bin RETVAL=$? [ $RETVAL -eq 0 ] && rm -f $proc echo return $RETVAL } restart() { stop start } reload() { restart } status_at() { status $bin } case "$1" in start) start ;; stop) stop ;; reload|restart) restart ;; condrestart) if [ -f $proc ]; then restart fi ;; status) status_at ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" exit 1 esac exit $? exit $RETVAL