Last active
November 30, 2019 23:28
-
-
Save vay3t/6fce312caa3bc84cea6943424c5b5d52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$(id -u)" != "0" ]; then | |
echo "Please run as root" | |
exit | |
else | |
if [ $# -eq 1 ]; then | |
if [ $1 == "on" ]; then | |
/usr/bin/cpupower -c all frequency-set -g performance &> /dev/null | |
if [ $? -eq 0 ]; then | |
echo on | |
#notify-send "turbo-cpu --> on" | |
else | |
echo error | |
fi | |
elif [ $1 == "off" ]; then | |
/usr/bin/cpupower -c all frequency-set -g powersave &> /dev/null | |
if [ $? -eq 0 ]; then | |
echo off | |
#notify-send "turbo-cpu --> off" | |
else | |
echo error | |
fi | |
elif [ $1 == "status" ]; then | |
status=$(/usr/bin/cpupower frequency-info | grep "The governor" | cut -d '"' -f2) | |
if [ $status == "performance" ]; then | |
echo on | |
#notify-send "turbo-cpu status on" | |
elif [ $status == "powersave" ]; then | |
echo off | |
#notify-send "turbo-cpu status off" | |
else | |
echo $status | |
#notify-send "turbo-cpu status $status" | |
fi | |
else | |
echo "Usage: $0 [on|off|status]" | |
exit | |
fi | |
else | |
echo "Usage: $0 [on|off|status]" | |
exit | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment