|
@@ -98,6 +98,64 @@ echo -e "Done."
|
|
}
|
|
}
|
|
|
|
|
|
function freeze_on {
|
|
function freeze_on {
|
|
|
|
+NEW_FAN=5
|
|
|
|
+NEW_THR=4
|
|
|
|
+if [ -f /home/$USER/scripts/run-fan.py ]
|
|
|
|
+then
|
|
|
|
+echo -e "\n\e[95mEnable \e[38;5;196mF\e[38;5;202mr\e[38;5;208me\e[38;5;214me\e[38;5;220mz\e[38;5;226mi\e[38;5;227mn\e[38;5;229mg\e[0m \e[95m:\e[0m"
|
|
|
|
+sudo systemctl stop run-fan.service
|
|
|
|
+if ! [ -f /home/$USER/freeze.txt ]
|
|
|
|
+then
|
|
|
|
+if grep "ON_THRESHOLD" /home/$USER/scripts/run-fan.py >/dev/null
|
|
|
|
+then
|
|
|
|
+grep -i "ON_THRESHOLD = " /home/$USER/scripts/run-fan.py |awk 'NR==1 {print$3;exit}' >/home/$USER/freeze.txt
|
|
|
|
+grep -i "OFF_THRESHOLD = " /home/$USER/scripts/run-fan.py |awk 'NR==1 {print$3;exit}' >>/home/$USER/freeze.txt
|
|
|
|
+fi
|
|
|
|
+fi
|
|
|
|
+OLD_FAN=`cat /home/$USER/freeze.txt| awk 'NR==1 {print $1;exit}'`
|
|
|
|
+OLD_THR=`cat /home/$USER/freeze.txt| awk 'NR==2 {print $1;exit}'`
|
|
|
|
+echo "Fan PWM value : $OLD_FAN => $NEW_FAN"
|
|
|
|
+echo "Fan Threshold : $OLD_THR => $NEW_THR"
|
|
|
|
+if grep "ON_THRESHOLD = " /home/$USER/scripts/run-fan.py >/dev/null
|
|
|
|
+then
|
|
|
|
+sed -i -e "s/ON_THRESHOLD = "$OLD_FAN"/ON_THRESHOLD = "$NEW_FAN"/g" /home/$USER/scripts/run-fan.py
|
|
|
|
+sed -i -e "s/OFF_THRESHOLD = "$OLD_THR"/OFF_THRESHOLD = "$NEW_THR"/g" /home/$USER/scripts/run-fan.py
|
|
|
|
+fi
|
|
|
|
+sudo systemctl restart run-fan.service
|
|
|
|
+echo -e "Done."
|
|
|
|
+fi
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function freeze_off {
|
|
|
|
+echo -e -n ""
|
|
|
|
+if [ -f /home/$USER/scripts/run-fan.py ]
|
|
|
|
+then
|
|
|
|
+echo -e "\n\e[95mDisable Freezing :\e[0m"
|
|
|
|
+OLD_FAN=`cat /home/$USER/freeze.txt| awk 'NR==1 {print $1;exit}'`
|
|
|
|
+OLD_THR=`cat /home/$USER/freeze.txt| awk 'NR==2 {print $1;exit}'`
|
|
|
|
+if grep "ON_THRESHOLD" /home/$USER/scripts/run-fan.py >/dev/null
|
|
|
|
+then
|
|
|
|
+echo "Fan PWM value : $NEW_FAN => $OLD_FAN"
|
|
|
|
+echo "Fan Threshold : $NEW_THR => $OLD_THR"
|
|
|
|
+else
|
|
|
|
+echo "Fan value: $NEW_FAN =>$OLD_FAN"
|
|
|
|
+fi
|
|
|
|
+sudo systemctl stop run-fan.service
|
|
|
|
+if grep "ON_THRESHOLD" /home/$USER/scripts/run-fan.py >/dev/null
|
|
|
|
+then
|
|
|
|
+sed -i -e "s/ON_THRESHOLD = "$NEW_FAN"/ON_THRESHOLD = "$OLD_FAN"/g" /home/$USER/scripts/run-fan.py
|
|
|
|
+sed -i -e "s/OFF_THRESHOLD = "$NEW_THR"/OFF_THRESHOLD = "$OLD_THR"/g" /home/$USER/scripts/run-fan.py
|
|
|
|
+else
|
|
|
|
+sed -i -e "s/self.startTemperature = "$NEW_FAN"/self.startTemperature = "$OLD_FAN"/g" /home/$USER/scripts/run-fan.py
|
|
|
|
+fi
|
|
|
|
+sudo systemctl restart run-fan.service
|
|
|
|
+if [ -f /home/$USER/freeze.txt ];then rm /home/$USER/freeze.txt;fi
|
|
|
|
+echo -e "Done."
|
|
|
|
+fi
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+function freeze_on_old {
|
|
NEW_FAN=5.0
|
|
NEW_FAN=5.0
|
|
if [ -f /home/$USER/scripts/run-fan.py ]
|
|
if [ -f /home/$USER/scripts/run-fan.py ]
|
|
then
|
|
then
|
|
@@ -105,14 +163,14 @@ echo -e "\n\e[95mEnable \e[38;5;196mF\e[38;5;202mr\e[38;5;208me\e[38;5;214me\e[3
|
|
sudo systemctl stop run-fan.service
|
|
sudo systemctl stop run-fan.service
|
|
if ! [ -f /home/$USER/freeze.txt ]
|
|
if ! [ -f /home/$USER/freeze.txt ]
|
|
then
|
|
then
|
|
-if grep "# Author: Andreas Spiess" /home/$USER/scripts/run-fan.py >/dev/null
|
|
|
|
|
|
+if grep "# Author: Andreas Spiess" /home/$USER/scripts/run-fan.py >/dev/null
|
|
then
|
|
then
|
|
grep -i "desiredTemp = " /home/$USER/scripts/run-fan.py |awk 'NR==1 {print$3;exit}' >/home/$USER/freeze.txt
|
|
grep -i "desiredTemp = " /home/$USER/scripts/run-fan.py |awk 'NR==1 {print$3;exit}' >/home/$USER/freeze.txt
|
|
else
|
|
else
|
|
grep -i "self.startTemperature = " /home/$USER/scripts/run-fan.py |awk 'NR==1 {print$3;exit}' >/home/$USER/freeze.txt
|
|
grep -i "self.startTemperature = " /home/$USER/scripts/run-fan.py |awk 'NR==1 {print$3;exit}' >/home/$USER/freeze.txt
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
-OLD_FAN=`cat /home/$USER/freeze.txt| awk '{print $1}'`
|
|
|
|
|
|
+OLD_FAN=`cat /home/$USER/freeze.txt | awk '{print $1}'`
|
|
echo "Fan PWM value : $OLD_FAN => $NEW_FAN"
|
|
echo "Fan PWM value : $OLD_FAN => $NEW_FAN"
|
|
if grep "# Author: Andreas Spiess" ~/scripts/run-fan.py >/dev/null
|
|
if grep "# Author: Andreas Spiess" ~/scripts/run-fan.py >/dev/null
|
|
then
|
|
then
|
|
@@ -126,7 +184,7 @@ sleep 1
|
|
fi
|
|
fi
|
|
}
|
|
}
|
|
|
|
|
|
-function freeze_off {
|
|
|
|
|
|
+function freeze_off_old {
|
|
echo -e -n ""
|
|
echo -e -n ""
|
|
if [ -f /home/$USER/scripts/run-fan.py ]
|
|
if [ -f /home/$USER/scripts/run-fan.py ]
|
|
then
|
|
then
|