wok-current annotate smartmontools/stuff/etc/init.d/smartd @ rev 3070

Up: geany (0.17)
author Christophe Lincoln <pankso@slitaz.org>
date Wed May 13 22:52:12 2009 +0200 (2009-05-13)
parents
children 1b6281d68d9f
rev   line source
erjo@621 1 #!/bin/sh
erjo@621 2 # /etc/init.d/smartd : Start, stop and restart Smartmontools (SMART) daemon on SliTaz, at
erjo@621 3 # boot time or with the command line.
erjo@621 4 #
erjo@621 5 # To start SMART monitoring at boot time, just put smartd in the $RUN_DAEMONS
erjo@621 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf
erjo@621 7 #
erjo@621 8 . /etc/init.d/rc.functions
erjo@621 9 . /etc/daemons.conf
erjo@621 10
erjo@621 11 NAME=smartd
erjo@621 12 DESC="Smartmontools (SMART) Daemon"
erjo@621 13 DAEMON=/usr/sbin/smartd
erjo@621 14
erjo@621 15 PIDFILE=/var/run/smartd.pid
erjo@621 16 OPTIONS="-p $PIDFILE"
erjo@621 17
erjo@621 18 case "$1" in
erjo@621 19 start)
erjo@621 20 if [ -f $PIDFILE ] ; then
erjo@621 21 echo "$NAME already running."
erjo@621 22 exit 1
erjo@621 23 fi
erjo@621 24 echo -n "Starting $DESC: $NAME... "
erjo@621 25 $DAEMON $OPTIONS
erjo@621 26 status
erjo@621 27 ;;
erjo@621 28 stop)
erjo@621 29 if [ ! -f $PIDFILE ] ; then
erjo@621 30 echo "$NAME is not running."
erjo@621 31 exit 1
erjo@621 32 fi
erjo@621 33 echo -n "Stopping $DESC: $NAME... "
erjo@621 34 kill `cat $PIDFILE`
erjo@621 35 status
erjo@621 36 ;;
erjo@621 37 restart)
erjo@621 38 if [ ! -f $PIDFILE ] ; then
erjo@621 39 echo "$NAME is not running."
erjo@621 40 exit 1
erjo@621 41 fi
erjo@621 42 echo -n "Restarting $DESC: $NAME... "
erjo@621 43 kill `cat $PIDFILE`
erjo@621 44 sleep 2
erjo@621 45 $DAEMON $OPTIONS
erjo@621 46 status
erjo@621 47 ;;
erjo@621 48 *)
erjo@621 49 echo ""
erjo@621 50 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
erjo@621 51 echo ""
erjo@621 52 exit 1
erjo@621 53 ;;
erjo@621 54 esac
erjo@621 55
erjo@621 56 exit 0