diff --git a/debian/callcontrol.init b/debian/callcontrol.init index 27e9706..4fe4c95 100644 --- a/debian/callcontrol.init +++ b/debian/callcontrol.init @@ -1,60 +1,65 @@ #! /bin/sh # ### BEGIN INIT INFO # Provides: callcontrol # Required-Start: $syslog $network $local_fs $remote_fs $time # Required-Stop: $syslog $network $local_fs $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start the SIP call control application # Description: Start the SIP call control application ### END INIT INFO NAME="callcontrol" DESC="SIP Call Control" PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/bin/call-control PIDFILE=/var/run/callcontrol/call-control.pid OPTIONS= test -f $DAEMON || exit 0 -set -e +. /lib/lsb/init-functions + +start() { + echo -n "Starting $DESC: $NAME" + start-stop-daemon --start --quiet --pidfile $PIDFILE \ + --exec $DAEMON -- $OPTIONS || echo -n " already running" + echo "." +} + +stop() { + echo -n "Stopping $DESC: $NAME" + start-stop-daemon --oknodo --stop --quiet --retry=TERM/15/KILL/5 --pidfile $PIDFILE + echo "." +} case "$1" in start) - echo -n "Starting $DESC: $NAME" - start-stop-daemon --start --quiet --pidfile $PIDFILE \ - --exec $DAEMON -- $OPTIONS || echo -n " already running" - echo "." + start ;; stop) - echo -n "Stopping $DESC: $NAME" - start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE - echo "." + stop ;; restart|force-reload) - echo -n "Restarting $DESC: $NAME" - start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE - start-stop-daemon --start --quiet --pidfile $PIDFILE \ - --exec $DAEMON -- $OPTIONS - echo "." + stop + start ;; sessions) $DAEMON "--debug=sessions" ;; session) $DAEMON "--debug=session" "callid=$2" ;; terminate) $DAEMON "--terminate=$2" ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|force-reload|sessions|session|terminate}" >&2 exit 1 ;; esac exit 0