3 # Provides: auerswald-callnotifier
4 # Required-Start: $local_fs $network
5 # Required-Stop: $local_fs $network
6 # Default-Start: 2 3 4 5
8 # Short-Description: Run the call notification program
11 # Author: Christian Weiske <cweiske@cweiske.de>
13 # PATH should only include /usr/* if it runs after the mountnfs.sh script
14 PATH=/sbin:/usr/sbin:/bin:/usr/bin
15 DESC="Run auerswald callnotifier"
18 DAEMON_ARGS="/usr/local/src/auerswald-callnotifier/callnotifier.php"
19 PIDFILE=/var/run/$NAME.pid
20 SCRIPTNAME=/etc/init.d/$NAME
22 # Exit if the package is not installed
23 [ -x "$DAEMON" ] || exit 0
25 # Load the VERBOSE setting and other rcS variables
28 # Define LSB log_* functions.
29 # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
30 # and status_of_proc is working.
31 . /lib/lsb/init-functions
36 # 0 if daemon has been started
37 # 1 if daemon was already running
38 # 2 if daemon could not be started
39 start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
41 start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE --exec $DAEMON -- \
49 # 0 if daemon has been stopped
50 # 1 if daemon was already stopped
51 # 2 if daemon could not be stopped
52 # other if a failure occurred
53 start-stop-daemon --stop --retry=TERM/5/KILL/5 --pidfile $PIDFILE
55 [ "$RETVAL" = 2 ] && return 2
56 [ "$RETVAL" = 0 ] && rm -f $PIDFILE
62 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
65 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
66 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
70 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
73 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
74 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
78 status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
81 log_daemon_msg "Restarting $DESC" "$NAME"
88 1) log_end_msg 1 ;; # Old process is still running
89 *) log_end_msg 1 ;; # Failed to start
99 #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
100 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2