diff --git a/throttler.sh b/throttler.sh index 5aa90dd..82bd8fd 100755 --- a/throttler.sh +++ b/throttler.sh @@ -1,44 +1,25 @@ #!/bin/bash - -#You can replace HandBrake with any Program you like -# but look for case sensitivity - -hbpid=$(pgrep HandBrake) +#-------[ File Description ]-------# +# You can replace HandBrake with any Program you like +# but look for case sensitivity. echo "This Script must be in the same directory like cputhrottle and be running with sudo. Alternatively you can add a path at the program call. If you want to end the script just make twice ctrl+c." -if [ -z "$hbpid" ] -then - echo "No HandBrake running! Exit!" - exit 1 -fi - -thrpid=$(pgrep cputhrottle) -#echo $thrpid -if [ -n "$thrpid" ] -then - echo "CpuThrottle already running. Exit" - exit 2 -fi - -#Here you can set your cpuPercentage Value you like +#-------[ Configuration ]-------# +# Here you can set your cpuPercentage Value you like cpuPerc=600 +# Checking time interval (in seconds) +chckInt=5 + +#-------[ Checking loop ]-------# while true do - if [ -z "$hbpid" ] - then - echo "No HandBrake running! Exit!" - exit 1 - fi - thrpid=$(pgrep cputhrottle) - #echo $thrpid if [ -z "$thrpid" ] then - echo "Starting cputhrottle..." date set -e @@ -46,5 +27,5 @@ do set +e fi - sleep 5 + sleep $chckInt done