Code/fan-enable.init

From ThinkWiki
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