Code/tp-fancontrol.init
- ! /bin/sh
- BEGIN INIT INFO
- Provides: tp-fancontrol
- Default-Start: 2 3 4 5
- Default-Stop: S 0 1 6
- END INIT INFO
- Copyright (c) 2006 Ronald Aigner <ra3@os.inf.tu-dresden.de>
set -e
DAEMON=/usr/bin/tp-fancontrol NAME=tp-fancontrol DAEMONUSER=root PIDDIR=/var/run PIDFILE=$PIDDIR/tp-fancontrol.pid DESC="Thinkpad CPU fan control"
test -x $DAEMON || exit 0
- source config file; edit that file to configure this script
TEMP_SHIFT=0 LOG_SYSLOG=1 QUIET=1 if [ -e /etc/tp-fancontrol.conf ]; then
. /etc/tp-fancontrol.conf
fi
start_it() {
PARAMS=-d if [ -e $PIDFILE ]; then echo "$DESC already running. Stop first." exit 1 fi if [ "$TEMP_SHIFT" != "0" ]; then PARAMS=$PARAMS" -s $TEMP_SHIFT" fi if [ "$LOG_SYSLOG" = "1" ]; then PARAMS=$PARAMS" -l" else if [ "$QUIET" = "1" ]; then PARAMS=$PARAMS" -q" fi fi PARAMS=$PARAMS" -p $PIDFILE"
echo -n "Starting $DESC: $NAME ... " $DAEMON $PARAMS if [ "$?" = "0" ]; then echo "Success." else echo "Error while starting: $?" fi
}
stop_it() {
if [ -e $PIDFILE ]; then echo -n "Stopping $DESC ... " $DAEMON -k if [ "$?" = "0" ]; then echo "Success." else echo "Error while stopping: $?" fi else echo "$DESC not running." fi
}
restart_it() {
if [ -e $PIDFILE ]; then stop_it sleep 2 fi start_it
}
case "$1" in
start) start_it ;; stop) stop_it ;; reload|force-reload|restart) restart_it ;; *) echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload}" >