4 # Provides: auerswald-callnotifier
5 # Required-Start: $local_fs $network $syslog mysql slapd
6 # Required-Stop: $local_fs $network $syslog
7 # Default-Start: 2 3 4 5
9 # Short-Description: Call notification program
12 # Author: Christian Weiske <cweiske@cweiske.de>
14 # PATH should only include /usr/* if it runs after the mountnfs.sh script
15 PATH=/sbin:/usr/sbin:/bin:/usr/bin
16 DESC="Run auerswald callnotifier"
17 NAME=auerswald-callnotifier
19 DAEMON_ARGS="/usr/local/src/auerswald-callnotifier/callnotifier.php"
20 PIDFILE=/var/run/$NAME.pid
21 SCRIPTNAME=/etc/init.d/$NAME
23 # Exit if the package is not installed
24 [ -x "$DAEMON" ] || exit 0
26 # Load the VERBOSE setting and other rcS variables
29 # Define LSB log_* functions.
30 # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
31 # and status_of_proc is working.
32 . /lib/lsb/init-functions
37 # 0 if daemon has been started
38 # 1 if daemon was already running
39 # 2 if daemon could not be started
40 start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
42 start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE\
43 --startas /bin/bash -- -c "exec $DAEMON $DAEMON_ARGS >> /var/log/$NAME.log 2>&1" \
45 #--exec $DAEMON -- $DAEMON_ARGS \
51 # 0 if daemon has been stopped
52 # 1 if daemon was already stopped
53 # 2 if daemon could not be stopped
54 # other if a failure occurred
55 start-stop-daemon --stop --retry=TERM/5/KILL/5 --pidfile $PIDFILE
57 [ "$RETVAL" = 2 ] && return 2
58 [ "$RETVAL" = 0 ] && rm -f $PIDFILE
64 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
67 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
68 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
72 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
75 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
76 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
80 status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
83 log_daemon_msg "Restarting $DESC" "$NAME"
90 1) log_end_msg 1 ;; # Old process is still running
91 *) log_end_msg 1 ;; # Failed to start
101 #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
102 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2