echo -e "\nProxmox IP \033[36m$(hostname -I)\033[m"
scaling_governor=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Current CPU Scaling Governor is set to $current_governor" --checklist "\nSelect the Scaling Governor to use:\n"16$((MSG_MAX_LENGTH +58))6"${GOVERNORS_MENU[@]}" 3>&1 1>&2 2>&3| tr -d '"')|| exit
echo -e "Available CPU Scaling Governors\n\033[36m${available_governors}\033[m\n"
whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "Current CPU Scaling Governor""\nCurrent CPU Scaling Governor has been set to $current_governor\n"1060
echo -e "Current CPU Scaling Governor\n\033[36m$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)\033[m\n"
CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "CPU Scaling Governor" --menu "This will establish a crontab to maintain the CPU Scaling Governor configuration across reboots.\n \nSetup a crontab?"14682\
options=""
"yes"" "\
i=1
"no"" " 3>&2 2>&1 1>&3)
for governor in $available_governors
do
case$CHOICE in
options+="** ${i}) \033[36m${governor}\033[m CPU Scaling Governor\n"
yes)
((i=i+1))
NEW_CRONTAB_COMMAND="(sleep 60 && echo \"$current_governor\" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor)"
done
EXISTING_CRONTAB=$(crontab -l 2>/dev/null)
echo -e "${options}"
if[[ -n "$EXISTING_CRONTAB"]];then
echo -e "\033[31mNOTE: Settings return to default after reboot\033[m\n"
TEMP_CRONTAB_FILE=$(mktemp)
read -p "Please choose an option from the menu and press [ENTER] or x to exit." opt