Sophie

Sophie

distrib > Mandriva > 2006.0 > i586 > by-pkgid > 05fdfa63fff65dce33b2464180cdca8a > files > 4

hddtemp-0.3-0.beta12.2mdk.src.rpm

#!/bin/sh
#
# hddtemp	This shell script takes care of starting and stopping hddtemp.
#
# chkconfig: 2345 90 10
# description: hddtemp provides information about hard drives' temperature
# processname: hddtemp
# config: /etc/sysconfig/hddtemp
# pidfile: /var/run/ldap/hddtemp

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# hddtemp configuration
[ -f /etc/sysconfig/hddtemp ] && . /etc/sysconfig/hddtemp

# Source function library.
if [ -f /etc/init.d/functions ] ; then
  . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
  . /etc/rc.d/init.d/functions
else
  exit 0
fi

RETVAL=0
prog=hddtemp

# Backwards compatibility.
[ -z "$HDDTEMP_OPTIONS" -a -n "$HDDTEMPARGS" ] && \
  HDDTEMP_OPTIONS="$HDDTEMPARGS"
HDDTEMP_OPTIONS="$HDDTEMP_OPTIONS $HDDTEMP_DAEMON_OPTIONS"

start() {
    gprintf "Starting hard disk temperature monitor daemon"
    daemon /usr/sbin/$prog -d $HDDTEMP_OPTIONS
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/hddtemp
    return $RETVAL
}

stop() {
    gprintf "Stopping hard disk temperature monitor daemon"
    killproc $prog
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys//var/lock/subsys/
    return $RETVAL
}

restart() {
    stop
    start
}

# See how we were called.
case "$1" in
    start|stop|restart)
        $1
        ;;
    reload|force-reload)
        restart
        ;;
    status)
        status $prog
        ;;
    try-restart|condrestart)
        [ ! -f $lockfile ] || restart
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}"
        exit 2
esac