summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/hddtemp/files/init
diff options
context:
space:
mode:
Diffstat (limited to 'meta-oe/recipes-support/hddtemp/files/init')
-rw-r--r--meta-oe/recipes-support/hddtemp/files/init100
1 files changed, 100 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/hddtemp/files/init b/meta-oe/recipes-support/hddtemp/files/init
new file mode 100644
index 000000000..0df8f67f6
--- /dev/null
+++ b/meta-oe/recipes-support/hddtemp/files/init
@@ -0,0 +1,100 @@
1#!/bin/sh
2#
3# skeleton example file to build /etc/init.d/ scripts.
4# This file should be used to construct scripts for /etc/init.d.
5#
6# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
7# Modified for Debian GNU/Linux
8# by Ian Murdock <imurdock@gnu.ai.mit.edu>.
9#
10# Version: @(#)skeleton 1.8 03-Mar-1998 miquels@cistron.nl
11#
12
13### BEGIN INIT INFO
14# Provides: hddtemp
15# Required-Start: $remote_fs $syslog $network
16# Required-Stop: $remote_fs $syslog $network
17# Default-Start: 2 3 4 5
18# Default-Stop: 0 1 6
19# Short-Description: disk temperature monitoring daemon
20# Description: hddtemp is a disk temperature monitoring daemon
21### END INIT INFO
22
23PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
24NAME=hddtemp
25DAEMON=/usr/sbin/$NAME
26DESC="disk temperature monitoring daemon"
27
28DISKS="/dev/hd[a-z] /dev/hd[a-z][a-z]"
29DISKS="$DISKS /dev/sd[a-z] /dev/sd[a-z][a-z]"
30DISKS="$DISKS /dev/sr[a-z] /dev/sr[a-z][a-z]"
31INTERFACE="0.0.0.0"
32PORT="7634"
33SEPARATOR="|"
34RUN_SYSLOG="0"
35
36# Reads config file (will override defaults above)
37[ -r /etc/default/hddtemp ] && . /etc/default/hddtemp
38
39if [ -n "$RUN_SYSLOG" ] && [ "$RUN_SYSLOG" != "0" ] ; then
40 SYSLOG_ARG="-S $RUN_SYSLOG"
41fi
42
43if [ "$RUN_DAEMON" = "true" ] || [ "$RUN_DAEMON" = "yes" ] ; then
44 DAEMON_ARG="-d -l $INTERFACE -p $PORT -s $SEPARATOR"
45fi
46
47[ -x "$DAEMON" ] || exit 0
48
49. /lib/lsb/init-functions
50
51case "$1" in
52 start)
53 # master switch
54 if [ -n "$DAEMON_ARG" ] || [ -n "$SYSLOG_ARG" ] ; then
55 log_daemon_msg "Starting $DESC" "$NAME:"
56 CDROMS_LIST=$(sed -ne 's/^drive name:\t\+\(.*\)$/ \/dev\/\1/p' /proc/sys/dev/cdrom/info 2>/dev/null) || :
57 CDROMS_LIST="$CDROMS_LIST $(grep -sl '^ide-scsi ' /proc/ide/hd*/driver | awk -F / '{ print "/dev/"$4 }')"
58 for disk in $DISKS ; do
59 echo $CDROMS_LIST | grep -wq $disk && continue
60 echo $DISKS_NOPROBE | grep -wq $disk && continue
61 if $DAEMON -wn $OPTIONS $disk 2>/dev/null | grep -q '^[0-9]\+$' ; then
62 DISKS_LIST="$DISKS_LIST $disk";
63 fi
64 done
65 if [ -n "$DISKS_LIST" ] || [ -n "$DISKS_NOPROBE" ] ; then
66 start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_ARG $SYSLOG_ARG $OPTIONS $DISKS_NOPROBE $DISKS_LIST
67 ret=$?
68 log_progress_msg "$DISKS_NOPROBE$DISKS_LIST"
69 log_end_msg $ret
70 else
71 log_progress_msg "no disks with monitoring capability were found."
72 log_end_msg 0
73 fi
74 fi
75 ;;
76 stop)
77 # master switch
78 if [ "$RUN_DAEMON" = "true" ] || [ "$RUN_DAEMON" = "yes" ] || [ "$RUN_SYSLOG" != "0" ] ; then
79 log_daemon_msg "Stopping $DESC" "$NAME"
80 start-stop-daemon --stop --oknodo --exec $DAEMON --retry 30
81 log_end_msg $?
82 fi
83 ;;
84 force-reload|reload)
85 exit 3
86 ;;
87 restart)
88 $0 stop && $0 start
89 ;;
90 status)
91 status_of_proc $DAEMON $NAME
92 exit $?
93 ;;
94 *)
95 echo "Usage: /etc/init.d/$NAME {start|stop|restart|status}" >&2
96 exit 1
97 ;;
98esac
99
100exit 0