dotfiles-linux/.local/bin/intel-turbo.sh
2024-01-06 03:41:49 +00:00

31 lines
458 B
Bash
Executable File

#!/bin/sh
bold=$(tput bold)
red=$(tput setaf 1)
green=$(tput setaf 2)
reset=$(tput sgr0)
syspath="/sys/devices/system/cpu/intel_pstate/no_turbo"
case "$1" in
on)
echo 0 > $syspath
;;
off)
echo 1 > $syspath
;;
*)
echo "Usage: $0 on|off"
echo
echo -n "Current turbo status: "
status=$(cat $syspath)
if [ "$status" = "0" ]; then
echo "${bold}${green}enabled${reset}"
else
echo "${bold}${red}disabled${reset}"
fi
;;
esac