3 # Provides: usb-wde-log
4 # Required-Start: $remote_fs $syslog
5 # Required-Stop: $remote_fs $syslog
6 # Default-Start: 2 3 4 5
8 # Short-Description: Logs temperature data
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="Logs temperature data"
18 DAEMON_ARGS="/usr/local/src/usb-wde1-tools/munin/usb-wde1-log-last.sh"
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
26 . /lib/lsb/init-functions
31 # 0 if daemon has been started
32 # 1 if daemon was already running
33 # 2 if daemon could not be started
34 start-stop-daemon --start --background --make-pidfile --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
36 start-stop-daemon --start --background --make-pidfile --quiet --pidfile $PIDFILE --exec $DAEMON -- \
44 # 0 if daemon has been stopped
45 # 1 if daemon was already stopped
46 # 2 if daemon could not be stopped
47 # other if a failure occurred
48 [ ! -f "$PIDFILE" ] && echo "$PIDFILE not found" && return 1
49 #kill all children (socat, line logger)
51 for i in `ps -ef| awk '$3 == '${ppid}' { print $2 }'`
55 start-stop-daemon --stop --quiet --retry=TERM/10/KILL/5 --pidfile $PIDFILE
57 [ "$RETVAL" = 2 ] && return 2
58 [ "$RETVAL" = 0 ] && rm -f $PIDFILE
63 start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
69 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
72 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
73 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
77 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
80 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
81 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
85 pid=`pgrep -f "$DAEMON $DAEMON_ARGS"`
86 [ "$pid" -gt 0 ] && echo "$NAME is running" && exit 0
87 echo "$NAME is NOT running"
90 log_daemon_msg "Restarting $DESC" "$NAME"
97 1) log_end_msg 1 ;; # Old process is still running
98 *) log_end_msg 1 ;; # Failed to start
108 #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
109 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2