Code/fan-enable.init

From ThinkWiki
Revision as of 22:22, 26 July 2006 by Thinker (Talk | contribs) (moved from ACPI fan control script)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  1. !/bin/sh

N=/etc/init.d/fan

set -e

case "$1" in

start)
      # make sure privileges don't persist across reboots
      if [ -d /var/run/fan ] && [ "x`ls /var/run/fan`" != x ]
      then
              touch -t 198501010000 /var/run/fan/*
      fi
      fan.sh &    # Script from above
      ;;
stop|reload|restart|force-reload)
      killall fan.sh
      echo enable > /proc/acpi/ibm/fan
      ;;
*)
      echo "Usage: $N {start|stop|restart|force-reload}" >&2
      exit 1
      ;;

esac

exit 0