#!/bin/sh # # skeleton example file to build /etc/init.d/ scripts. # This file should be used to construct scripts for /etc/init.d. # # Written by Miquel van Smoorenburg . # Modified for Debian GNU/Linux # by Ian Murdock . # # Version: @(#)skeleton 1.8 03-Mar-1998 miquels@cistron.nl # ### BEGIN INIT INFO # Provides: hddtemp # Required-Start: $remote_fs $syslog $network # Required-Stop: $remote_fs $syslog $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: disk temperature monitoring daemon # Description: hddtemp is a disk temperature monitoring daemon ### END INIT INFO global PATH := '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin' global NAME := 'hddtemp' global DAEMON := "/usr/sbin/$NAME" global DESC := '"disk temperature monitoring daemon'" global DISKS := '"/dev/hd[a-z] /dev/hd[a-z][a-z]'" global DISKS := ""$DISKS /dev/sd[a-z] /dev/sd[a-z][a-z]"" global DISKS := ""$DISKS /dev/sr[a-z] /dev/sr[a-z][a-z]"" global INTERFACE := '"0.0.0.0'" global PORT := '"7634'" global SEPARATOR := '"|'" global RUN_SYSLOG := '"0'" # Reads config file (will override defaults above) test -r /etc/default/hddtemp && source /etc/default/hddtemp if test -n $RUN_SYSLOG && test $RUN_SYSLOG != "0" { global SYSLOG_ARG := ""-S $RUN_SYSLOG"" } if test $RUN_DAEMON = "true" || test $RUN_DAEMON = "yes" { global DAEMON_ARG := ""-d -l $INTERFACE -p $PORT -s $SEPARATOR"" } test -x $DAEMON || exit 0 source /lib/lsb/init-functions matchstr $1 { start { # master switch if test -n $DAEMON_ARG || test -n $SYSLOG_ARG { log_daemon_msg "Starting $DESC" "$NAME:" global CDROMS_LIST := $[sed -ne 's/^drive name:\t\+\(.*\)$/ \/dev\/\1/p' /proc/sys/dev/cdrom/info !2 >/dev/null] || : global CDROMS_LIST := ""$CDROMS_LIST $[grep -sl '^ide-scsi ' /proc/ide/hd*/driver | awk -F / '{ print "/dev/"$4 }]"" for disk in [$DISKS] { echo $CDROMS_LIST | grep -wq $disk && continue echo $DISKS_NOPROBE | grep -wq $disk && continue if $DAEMON -wn $OPTIONS $disk !2 >/dev/null | grep -q '^[0-9]\+$' { global DISKS_LIST := ""$DISKS_LIST $disk""; } } if test -n $DISKS_LIST || test -n $DISKS_NOPROBE { start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_ARG $SYSLOG_ARG $OPTIONS $DISKS_NOPROBE $DISKS_LIST global ret := $Status log_progress_msg "$DISKS_NOPROBE$DISKS_LIST" log_end_msg $ret } else { log_progress_msg "no disks with monitoring capability were found." log_end_msg 0 } } } stop { # master switch if test $RUN_DAEMON = "true" || test $RUN_DAEMON = "yes" || test $RUN_SYSLOG != "0" { log_daemon_msg "Stopping $DESC" $NAME start-stop-daemon --stop --oknodo --exec $DAEMON --retry 30 log_end_msg $Status } } force-reload|reload { exit 3 } restart { $0 stop && $0 start } status { status_of_proc $DAEMON $NAME exit $Status } * { echo "Usage: /etc/init.d/$NAME {start|stop|restart|status}" > !2 exit 1 } } exit 0