CPU frequency fixer for GNU/Linux
authormirabilos <m@mirbsd.org>
Fri, 27 Jan 2017 18:49:58 +0000 (18:49 +0000)
committermirabilos <m@mirbsd.org>
Fri, 27 Jan 2017 18:49:58 +0000 (18:49 +0000)
mksh/sysadmin/schnell [new file with mode: 0644]

diff --git a/mksh/sysadmin/schnell b/mksh/sysadmin/schnell
new file mode 100644 (file)
index 0000000..d3a2f2b
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/mksh
+
+# run as root
+(( USER_ID )) && exec sudo "$0" "$@"
+
+# run verbosely
+set -x
+
+# decide what to do
+case x$1 {
+(x|xauto)
+       for a in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo ondemand >$a; done
+       ;;
+(x1|xon)
+       for a in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo performance >$a; done
+       ;;
+(x0|xoff)
+       for a in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo powersave >$a; done
+       ;;
+(*)
+       echo call with on/off/auto
+       exit 1
+       ;;
+}
+exit 0