From f777a968ea6f782fc51d23cad82b17b8094d6d70 Mon Sep 17 00:00:00 2001 From: tteckster Date: Sat, 29 Oct 2022 23:21:13 -0400 Subject: [PATCH] Update scaling-governor.sh revert changes --- misc/scaling-governor.sh | 84 ++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 46 deletions(-) diff --git a/misc/scaling-governor.sh b/misc/scaling-governor.sh index 4a5821b2..8eace5bd 100644 --- a/misc/scaling-governor.sh +++ b/misc/scaling-governor.sh @@ -4,14 +4,14 @@ set -e while true; do read -p "View CPU Scaling Governors. Proceed(y/n)?" yn case $yn in - [Yy]*) break ;; - [Nn]*) exit ;; - *) echo "Please answer yes or no." ;; + [Yy]* ) break;; + [Nn]* ) exit;; + * ) echo "Please answer yes or no.";; esac done clear function header_info { - echo -e " +echo -e " _____ _____ _ _ / ____| __ \| | | | | | | |__) | | | | @@ -21,16 +21,16 @@ function header_info { Scaling Governors " } -show_menu() { - CL=$(echo "\033[m") - GN=$(echo "\033[32m") - BL=$(echo "\033[36m") - YW=$(echo "\033[33m") - fgred=$(echo "\033[31m") - header_info +show_menu(){ + CL=`echo "\033[m"` + GN=`echo "\033[32m"` + BL=`echo "\033[36m"` + YW=`echo "\033[33m"` + fgred=`echo "\033[31m"` +header_info CK=$(uname -r) IP=$(hostname -I) - # MAC=$(cat /sys/class/net/eno1/address) +# MAC=$(cat /sys/class/net/eno1/address) ACSG=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors) CCSG=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor) echo -e "${YW}Proxmox IP ${BL}${IP}${CL}" @@ -41,7 +41,7 @@ show_menu() { echo -e "\n${YW}Available CPU Scaling Governors ${BL}${ACSG}${CL}" - + echo -e "\n${YW}Current CPU Scaling Governor ${BL}${CCSG}${CL}" printf "\n ${fgred}Only Select Available CPU Scaling Governors From Above${CL}\n \n" @@ -57,51 +57,43 @@ show_menu() { } clear show_menu -while [ $opt != '' ]; do +while [ $opt != '' ] + do if [ $opt = '' ]; then - exit + exit; else - case $opt in - 1) - echo "conservative" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor - clear - show_menu - ;; - 2) - echo "ondemand" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor + case $opt in + 1) echo "conservative" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor clear show_menu - ;; - 3) - echo "userspace" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor + ;; + 2) echo "ondemand" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor clear show_menu - ;; - 4) - echo "powersave" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor + ;; + 3) echo "userspace" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor clear show_menu - ;; - 5) - echo "performance" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor + ;; + 4) echo "powersave" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor clear show_menu - ;; - 6) - echo "schedutil" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor + ;; + 5) echo "performance" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor clear show_menu - ;; - x) - exit - ;; - \n) - exit - ;; - *) + ;; + 6) echo "schedutil" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor clear show_menu - ;; - esac + ;; + x)exit; + ;; + \n)exit; + ;; + *)clear; + show_menu; + ;; + esac fi -done + done