2022-03-25 13:19:34 +00:00
|
|
|
#!/usr/bin/env bash
|
2023-02-07 17:15:22 +00:00
|
|
|
|
|
|
|
# Copyright (c) 2021-2023 tteck
|
|
|
|
# Author: tteck (tteckster)
|
|
|
|
# License: MIT
|
|
|
|
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
|
|
|
|
2023-03-09 01:19:37 +00:00
|
|
|
header_info() {
|
|
|
|
clear
|
|
|
|
cat <<EOF
|
2023-01-10 16:16:26 +00:00
|
|
|
__________ __ __
|
|
|
|
/ ____/ __ \/ / / /
|
|
|
|
/ / / /_/ / / / /
|
|
|
|
/ /___/ ____/ /_/ /
|
|
|
|
\____/_/ \____/
|
|
|
|
Scaling Governors
|
|
|
|
EOF
|
|
|
|
}
|
2022-03-25 13:28:41 +00:00
|
|
|
while true; do
|
2023-03-09 08:40:38 +00:00
|
|
|
header_info
|
2022-03-25 15:28:17 +00:00
|
|
|
read -p "View CPU Scaling Governors. Proceed(y/n)?" yn
|
2022-03-25 13:28:41 +00:00
|
|
|
case $yn in
|
2022-10-30 03:45:14 +00:00
|
|
|
[Yy]*) break ;;
|
|
|
|
[Nn]*) exit ;;
|
|
|
|
*) echo "Please answer yes or no." ;;
|
2022-03-25 13:28:41 +00:00
|
|
|
esac
|
|
|
|
done
|
2022-10-30 03:45:14 +00:00
|
|
|
show_menu() {
|
|
|
|
header_info
|
2023-03-09 01:19:37 +00:00
|
|
|
echo -e "\nProxmox IP \033[36m$(hostname -I)\033[m"
|
|
|
|
echo -e "Current Kernel \033[36m$(uname -r)\033[m\n"
|
|
|
|
available_governors=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors)
|
|
|
|
echo -e "Available CPU Scaling Governors\n\033[36m${available_governors}\033[m\n"
|
|
|
|
echo -e "Current CPU Scaling Governor\n\033[36m$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)\033[m\n"
|
|
|
|
options=""
|
|
|
|
i=1
|
|
|
|
for governor in $available_governors
|
|
|
|
do
|
|
|
|
options+="** ${i}) \033[36m${governor}\033[m CPU Scaling Governor\n"
|
|
|
|
((i=i+1))
|
|
|
|
done
|
|
|
|
echo -e "${options}"
|
|
|
|
echo -e "\033[31mNOTE: Settings return to default after reboot\033[m\n"
|
|
|
|
read -p "Please choose an option from the menu and press [ENTER] or x to exit." opt
|
2022-03-25 13:19:34 +00:00
|
|
|
}
|
|
|
|
show_menu
|
2023-03-09 01:19:37 +00:00
|
|
|
while [[ "$opt" != "" ]]; do
|
|
|
|
num_governors=$(echo "$available_governors" | wc -w)
|
|
|
|
if [[ $opt -gt 0 ]] && [[ $opt -le $num_governors ]]; then
|
|
|
|
governor=$(echo "$available_governors" | cut -d' ' -f $opt)
|
|
|
|
echo "${governor}" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
|
|
|
elif [[ $opt == "x" ]] || [[ $opt == "\n" ]]; then
|
2022-10-30 03:45:14 +00:00
|
|
|
exit
|
2022-03-25 13:19:34 +00:00
|
|
|
else
|
2023-03-09 01:19:37 +00:00
|
|
|
show_menu
|
2022-03-25 13:19:34 +00:00
|
|
|
fi
|
2023-03-09 01:19:37 +00:00
|
|
|
show_menu
|
2022-10-30 03:45:14 +00:00
|
|
|
done
|