diff options
Diffstat (limited to 'meta-oe/recipes-support/hddtemp/files/init')
-rw-r--r-- | meta-oe/recipes-support/hddtemp/files/init | 100 |
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 | |||
23 | PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | ||
24 | NAME=hddtemp | ||
25 | DAEMON=/usr/sbin/$NAME | ||
26 | DESC="disk temperature monitoring daemon" | ||
27 | |||
28 | DISKS="/dev/hd[a-z] /dev/hd[a-z][a-z]" | ||
29 | DISKS="$DISKS /dev/sd[a-z] /dev/sd[a-z][a-z]" | ||
30 | DISKS="$DISKS /dev/sr[a-z] /dev/sr[a-z][a-z]" | ||
31 | INTERFACE="0.0.0.0" | ||
32 | PORT="7634" | ||
33 | SEPARATOR="|" | ||
34 | RUN_SYSLOG="0" | ||
35 | |||
36 | # Reads config file (will override defaults above) | ||
37 | [ -r /etc/default/hddtemp ] && . /etc/default/hddtemp | ||
38 | |||
39 | if [ -n "$RUN_SYSLOG" ] && [ "$RUN_SYSLOG" != "0" ] ; then | ||
40 | SYSLOG_ARG="-S $RUN_SYSLOG" | ||
41 | fi | ||
42 | |||
43 | if [ "$RUN_DAEMON" = "true" ] || [ "$RUN_DAEMON" = "yes" ] ; then | ||
44 | DAEMON_ARG="-d -l $INTERFACE -p $PORT -s $SEPARATOR" | ||
45 | fi | ||
46 | |||
47 | [ -x "$DAEMON" ] || exit 0 | ||
48 | |||
49 | . /lib/lsb/init-functions | ||
50 | |||
51 | case "$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 | ;; | ||
98 | esac | ||
99 | |||
100 | exit 0 | ||