From 3d3583488aa53af1fb637f4e1e62d2c385bd10a9 Mon Sep 17 00:00:00 2001 From: tteckster Date: Wed, 11 Oct 2023 15:31:27 -0400 Subject: [PATCH] Update scaling-governor.sh tweak --- misc/scaling-governor.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/misc/scaling-governor.sh b/misc/scaling-governor.sh index 74e1feeb..556a3854 100644 --- a/misc/scaling-governor.sh +++ b/misc/scaling-governor.sh @@ -4,7 +4,7 @@ # Author: tteck (tteckster) # License: MIT # https://github.com/tteck/Proxmox/raw/main/LICENSE - +set -e header_info() { clear cat <&1 1>&2 2>&3 | tr -d '"') || exit +[ -z "$scaling_governor" ] && { + whiptail --backtitle "Proxmox VE Helper Scripts" --title "No CPU Scaling Governor Selected" --msgbox "It appears that no CPU Scaling Governor was selected" 10 68 + clear + exit +} echo "${scaling_governor}" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor >/dev/null current_governor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor) whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "Current CPU Scaling Governor" "\nCurrent CPU Scaling Governor has been set to $current_governor\n" 10 60 @@ -34,6 +39,7 @@ CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "CPU Scaling G case $CHOICE in yes) + set +e NEW_CRONTAB_COMMAND="(sleep 60 && echo \"$current_governor\" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor)" EXISTING_CRONTAB=$(crontab -l 2>/dev/null) if [[ -n "$EXISTING_CRONTAB" ]]; then