/rc2.d/S99ondemand

http://github.com/brinkman83/bashrc · Shell · 40 lines · 26 code · 5 blank · 9 comment · 2 complexity · cc2a79a545967eec1170dc2bb44468e0 MD5 · raw file

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: ondemand
  4. # Required-Start: $remote_fs $all
  5. # Required-Stop:
  6. # Default-Start: 2 3 4 5
  7. # Default-Stop:
  8. # Short-Description: Set the CPU Frequency Scaling governor to "ondemand"
  9. ### END INIT INFO
  10. PATH=/sbin:/usr/sbin:/bin:/usr/bin
  11. . /lib/init/vars.sh
  12. . /lib/lsb/init-functions
  13. case "$1" in
  14. start)
  15. start-stop-daemon --start --background --exec /etc/init.d/ondemand -- background
  16. ;;
  17. background)
  18. sleep 60 # probably enough time for desktop login
  19. for CPUFREQ in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
  20. do
  21. [ -f $CPUFREQ ] || continue
  22. echo -n ondemand > $CPUFREQ
  23. done
  24. ;;
  25. restart|reload|force-reload)
  26. echo "Error: argument '$1' not supported" >&2
  27. exit 3
  28. ;;
  29. stop)
  30. ;;
  31. *)
  32. echo "Usage: $0 start|stop" >&2
  33. exit 3
  34. ;;
  35. esac