PageRenderTime 27ms CodeModel.GetById 13ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 1ms

/rc3.d/S20sensord

http://github.com/brinkman83/bashrc
Shell | 64 lines | 46 code | 8 blank | 10 comment | 13 complexity | 4b1aa03abd5cadff1001c7a03b90eaab MD5 | raw file
 1#!/bin/sh
 2
 3### BEGIN INIT INFO
 4# Provides:          sensord
 5# Required-Start:    $remote_fs $syslog lm-sensors
 6# Required-Stop:     $remote_fs $syslog
 7# Default-Start:     2 3 4 5
 8# Default-Stop:
 9# Short-Description: lm-sensors daemon
10# Description:       hardware sensor information logging daemon
11### END INIT INFO
12
13. /lib/lsb/init-functions
14
15[ -f /etc/default/rcS ] && . /etc/default/rcS
16PATH=/bin:/usr/bin:/sbin:/usr/sbin
17DAEMON=/usr/sbin/sensord
18DESC="sensor daemon"
19NAME="sensord"
20PIDFILE=/var/run/sensord.pid
21CONFIG=/etc/default/sensord
22
23test -x $DAEMON || exit 0
24
25if [ -f $CONFIG ]; then . $CONFIG; fi
26
27if [ -n "$ALARM_INTERVAL" ]; then ALARM_INTERVAL="-i $ALARM_INTERVAL"; fi
28if [ -n "$LOG_INTERVAL" ]; then LOG_INTERVAL="-l $LOG_INTERVAL"; fi
29if [ -n "$SYSLOG_FACILITY" ]; then SYSLOG_FACILITY="-f $SYSLOG_FACILITY"; fi
30if [ -n "$CONFIG_FILE" ]; then CONFIG_FILE="-c $CONFIG_FILE"; fi
31if [ -n "$RRD_FILE" ]; then RRD_FILE="-r $RRD_FILE"; fi
32if [ -n "$RRD_INTERVAL" ]; then RRD_INTERVAL="-t $RRD_INTERVAL"; fi
33if [ -n "$RRD_LOADAVG" ]; then RRD_LOADAVG="-a"; fi
34
35case "$1" in
36  start)
37	log_daemon_msg "Starting $DESC" "$NAME"
38	/sbin/start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $ALARM_INTERVAL $LOG_INTERVAL $SYSLOG_FACILITY $RRD_INTERVAL $RRD_FILE $RRD_LOADAVG $CONFIG_FILE $SCAN_CHIPS
39	log_end_msg $?
40	;;
41  stop)
42	log_daemon_msg "Stopping $DESC" "$NAME"
43	start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo --exec $DAEMON
44	log_end_msg $?
45	;;
46  restart)
47	$0 stop
48	sleep 1
49	$0 start
50	;;
51  force-reload)
52	if start-stop-daemon --stop --test --quiet --pidfile $PIDFILE --exec $DAEMON ; then
53		$0 restart
54	fi
55	;;
56  status)
57	status_of_proc $DAEMON $NAME && exit 0 || exit $?
58	;;
59  *)
60	echo "Usage: /etc/init.d/sensord {start|stop|restart|force-reload|status}"
61	exit 1
62esac
63
64exit 0