mirror of https://github.com/tteck/Proxmox.git
Compare commits
No commits in common. "3d3583488aa53af1fb637f4e1e62d2c385bd10a9" and "6aeda1d4ff2bab2c6891fba42068e8ca4849edbe" have entirely different histories.
3d3583488a
...
6aeda1d4ff
|
@ -5,14 +5,6 @@
|
||||||
|
|
||||||
- All LXC instances created using this repository come pre-installed with Midnight Commander, which is a command-line tool (`mc`) that offers a user-friendly file and directory management interface for the terminal environment.
|
- All LXC instances created using this repository come pre-installed with Midnight Commander, which is a command-line tool (`mc`) that offers a user-friendly file and directory management interface for the terminal environment.
|
||||||
|
|
||||||
## 2023-10-11
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
|
|
||||||
- **Proxmox VE CPU Scaling Governor**
|
|
||||||
- A full code overhaul.
|
|
||||||
- Include an option to configure a crontab for ensuring that the CPU Scaling Governor configuration persists across reboots.
|
|
||||||
|
|
||||||
## 2023-10-08
|
## 2023-10-08
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -51,7 +51,6 @@ $STD apt-get -y install \
|
||||||
$STD pip3 install mac-vendor-lookup
|
$STD pip3 install mac-vendor-lookup
|
||||||
$STD pip3 install fritzconnection
|
$STD pip3 install fritzconnection
|
||||||
$STD pip3 install cryptography
|
$STD pip3 install cryptography
|
||||||
$STD pip3 install pyunifi
|
|
||||||
msg_ok "Installed Python Dependencies"
|
msg_ok "Installed Python Dependencies"
|
||||||
|
|
||||||
msg_info "Installing Pi.Alert"
|
msg_info "Installing Pi.Alert"
|
||||||
|
|
|
@ -4,55 +4,55 @@
|
||||||
# Author: tteck (tteckster)
|
# Author: tteck (tteckster)
|
||||||
# License: MIT
|
# License: MIT
|
||||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
||||||
set -e
|
|
||||||
header_info() {
|
header_info() {
|
||||||
clear
|
clear
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
________ __ __ _____
|
__________ __ __
|
||||||
/ ___/ _ \/ / / / / ___/__ _ _____ _______ ___ _______
|
/ ____/ __ \/ / / /
|
||||||
/ /__/ ___/ /_/ / / (_ / _ \ |/ / -_) __/ _ \/ _ \/ __(_-<
|
/ / / /_/ / / / /
|
||||||
\___/_/ \____/ \___/\___/___/\__/_/ /_//_/\___/_/ /___/
|
/ /___/ ____/ /_/ /
|
||||||
|
\____/_/ \____/
|
||||||
|
Scaling Governors
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
header_info
|
while true; do
|
||||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "CPU Scaling Governors" --yesno "View/Change CPU Scaling Governors. Proceed?" 10 58 || exit
|
header_info
|
||||||
current_governor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
|
read -p "View CPU Scaling Governors. Proceed(y/n)?" yn
|
||||||
GOVERNORS_MENU=()
|
case $yn in
|
||||||
MSG_MAX_LENGTH=0
|
[Yy]*) break ;;
|
||||||
while read -r TAG ITEM; do
|
[Nn]*) exit ;;
|
||||||
OFFSET=2
|
*) echo "Please answer yes or no." ;;
|
||||||
((${#ITEM} + OFFSET > MSG_MAX_LENGTH)) && MSG_MAX_LENGTH=${#ITEM}+OFFSET
|
esac
|
||||||
GOVERNORS_MENU+=("$TAG" "$ITEM " "OFF")
|
done
|
||||||
done < <(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors | tr ' ' '\n' | grep -v "$current_governor")
|
show_menu() {
|
||||||
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
|
header_info
|
||||||
[ -z "$scaling_governor" ] && {
|
echo -e "\nProxmox IP \033[36m$(hostname -I)\033[m"
|
||||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "No CPU Scaling Governor Selected" --msgbox "It appears that no CPU Scaling Governor was selected" 10 68
|
echo -e "Current Kernel \033[36m$(uname -r)\033[m\n"
|
||||||
clear
|
available_governors=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors)
|
||||||
exit
|
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
|
||||||
}
|
}
|
||||||
echo "${scaling_governor}" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor >/dev/null
|
show_menu
|
||||||
current_governor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
|
while [[ "$opt" != "" ]]; do
|
||||||
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
|
num_governors=$(echo "$available_governors" | wc -w)
|
||||||
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?" 14 68 2 \
|
if [[ $opt -gt 0 ]] && [[ $opt -le $num_governors ]]; then
|
||||||
"yes" " " \
|
governor=$(echo "$available_governors" | cut -d' ' -f $opt)
|
||||||
"no" " " 3>&2 2>&1 1>&3)
|
echo "${governor}" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
||||||
|
elif [[ $opt == "x" ]] || [[ $opt == "\n" ]]; then
|
||||||
case $CHOICE in
|
exit
|
||||||
yes)
|
else
|
||||||
set +e
|
show_menu
|
||||||
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
|
|
||||||
TEMP_CRONTAB_FILE=$(mktemp)
|
|
||||||
echo "$EXISTING_CRONTAB" | grep -v "@reboot (sleep 60 && echo*" > "$TEMP_CRONTAB_FILE"
|
|
||||||
crontab "$TEMP_CRONTAB_FILE"
|
|
||||||
rm "$TEMP_CRONTAB_FILE"
|
|
||||||
fi
|
fi
|
||||||
(crontab -l 2>/dev/null; echo "@reboot $NEW_CRONTAB_COMMAND") | crontab -
|
show_menu
|
||||||
echo -e "\nCrontab Set (use 'crontab -e' to check)"
|
done
|
||||||
;;
|
|
||||||
no)
|
|
||||||
echo -e "\n\033[31mNOTE: Settings return to default after reboot\033[m\n"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
echo -e "Current CPU Scaling Governor is set to \033[36m$current_governor\033[m\n"
|
|
||||||
|
|
Loading…
Reference in New Issue