Skip to content

Instantly share code, notes, and snippets.

@vay3t
Last active November 30, 2019 23:28
Show Gist options
  • Save vay3t/6fce312caa3bc84cea6943424c5b5d52 to your computer and use it in GitHub Desktop.
Save vay3t/6fce312caa3bc84cea6943424c5b5d52 to your computer and use it in GitHub Desktop.
#!/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