-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathcpuOC.sh
executable file
·32 lines (24 loc) · 918 Bytes
/
cpuOC.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# CPU Governor OC Script. Can be automatically applied on boot.
#
# Copyright (c) 2024 RoyalGraphX
# BSD 3-Clause License
#
echo "Available CPU Governors:"
available_governors=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors)
IFS=' ' read -r -a governors <<< "$available_governors"
for ((i=0; i<${#governors[@]}; i++)); do
echo "$i. ${governors[$i]}"
done
read -p "Enter the number corresponding to the desired governor: " selected_governor
if [[ $selected_governor -lt 0 || $selected_governor -ge ${#governors[@]} ]]; then
echo "Invalid selection. Exiting..."
exit 1
fi
selected_governor_name="${governors[$selected_governor]}"
echo "Applying $selected_governor_name governor..."
sudo cpupower frequency-set -g "$selected_governor_name"
echo "Waiting for changes to take effect..."
sleep 3
sudo cpupower monitor
echo "Thanks for using the CPU Governor OC Script!"