[Linux] Thinkfan Init-Script

Hi,

wenn man sich bei openSuSE per home-repository thinkfan zur Steuerung der Fans installiert, bekommt man leider kein Init-Script dazu. Daher habe ich ein Basic-Init-Script geschrieben:

#! /bin/sh
#
# Author: Sebastian Deubel
#
#
# /etc/init.d/thinkfan
#
### BEGIN INIT INFO
# Provides: thinkfan
# Required-Start: $local_fs $remote_fs $network
# Should-Start: $syslog $time $named network-remotefs
# Required-Stop: $local_fs $remote_fs $network
# Should-Stop: $syslog $time $named network-remotefs
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Thinkfan
# Description: Start Thinkpad Fan Control
### END INIT INFO

case “$1” in
start)

/usr/bin/thinkfan -c /etc/thinkfan.conf.thinkpad

;;

stop)
rm -rf /var/run/thinkfan.pid
PROC=`ps -ef |grep thinkfan|egrep -v “grep” |awk ‘{ print $2 }’`
kill -9 $PROC
;;

restart)
$0 stop
$0 start
;;

status)
if pidof -o %PPID thinkfan > /dev/null; then
echo “Running”
echo “———————————-”
cat /proc/acpi/ibm/fan
exit 0
else
echo “Not running”
exit 1
fi
;;

*)
echo “Usage: $0 {start|stop|restart|status}”
exit 1
esac

Leave a Reply

Your email address will not be published.