[arm-allstar] cpu_temp.sh ?

Luc Drolet VE2LUQ ldrolet at cgocable.ca
Sun Apr 14 19:38:54 EDT 2024


Good evening to all of you,

I did this
and look at the message I got and on other repeaters does it work?


——————————————————————————————————————————

[root at NODE1400 ~]# /etc/asterisk/local/cpu_temp.sh
cat: /sys/class/thermal/thermal_zone0/temp: Invalid argument
expr: syntax error
C / expr: non-integer argument
F
/etc/asterisk/local/cpu_temp.sh: line 52: [: -gt: unary operator expected

————————————————————————————————————————




#!/bin/bash
#
# EXAMPLE Script pour envoyé des  email ou des  SMS si
# CPU temperature depase la temperature  maximum.
# The ssmtp package must be installed and configured

#  3/2019

# ----------------------------
# ATTENTION, note de LUC
# si nous voulons plusieurs cellulaire ou E-Mail
# Nous devons ajouter 
# RECIVER2= 418xxxxxx at xxxxxx
# RECIVER3= 418xxxxxx at xxxxxx
# et aussi sur les 2 lignes de commande  soit WARNING et CPU temp OK
# Voir plus bas
# ------------------------------

# Maximum CPU Temperature in Degrees C
MAXTEMP="35"

# Destination SMS number and address – CHANGE THIS!
#RECEIVER=""
#RECEIVER2=""
RECEIVER3="ldrolet at cgocable.ca"
#RECEIVER4=""
#RECEIVER7=""


# How often to alert if temperature is exceeded - Default 30 Minutes
ALERT_INTERVAL="30m"

function send_mail_warning() {
echo -e "Subject: ATTENTION CPU Haute Temp\nTo: $RECEIVER,$RECEIVER3,$RECEIVER4,RECEIVER7\n\nATTENTION Temperature du CPU
$CTEMP C au site du $HOSTNAME" | sendmail -t
}

function send_mail_OK() {
echo -e "Subject: CPU Temp est OK\nTo: $RECEIVER,$RECEIVER3,$RECEIVER4,RECEIVER7\n\nCPU Temperature OK 
$CTEMP C au site du $HOSTNAME" | sendmail -t
}

while :
do
PTEMP=`cat /sys/class/thermal/thermal_zone0/temp`
CTEMP=`expr $PTEMP / 1000`
echo -n $CTEMP
echo -n "C / "
FTEMP=`expr 9 '*' $CTEMP / 5 + 32`
echo -n "$FTEMP"
echo "F"
if [ $CTEMP -gt $MAXTEMP ]
 then
 echo "Sending temperature warning message - CPU $CTEMP C"
 send_mail_warning
 while [ $CTEMP -gt $MAXTEMP ]
 do
 sleep $ALERT_INTERVAL
# 
# ajout par Luc
PTEMP=`cat /sys/class/thermal/thermal_zone0/temp`
CTEMP=`expr $PTEMP / 1000`
# par Luc 
#
 if [ $CTEMP -le $MAXTEMP ]
 then
 echo "CPU Temperature Normal $CTEMP C"
 send_mail_OK

 break
 else
 echo "Sending temperature warning message - CPU $CTEMP C"
 send_mail_warning
 fi
 done
fi
sleep 30
done


I have repeaters for which I have the temperature, and 2 or 3 repeaters which do not work?
I still have the same error message

Thank you and have a good evening to all of you



Luc Drolet VE2 LUQ
Président de VE2CVA
C.R.A.V.A.
Club Radio Amateur Vallée de l'Amiante
VE2 CVA
ve2cva at gmail.com
ldrolet at cgocable.ca
https://clubs.raqi.ca/ve2cva/
https://www.facebook.com/groups/ve2cva
Instagram : https://www.instagram.com/ve2cva/
Echolink =   VE2RVA-R    NODE #24560
Sécurité Civil du Québec, Node #1400








> Le 12 avr. 2024 à 19:50, Luc Drolet VE2LUQ via ARM-allstar <arm-allstar at hamvoip.org> a écrit :
> 
> Hello everyone,
> 
> I have one of my repeaters that the temperature has reached 52 C
> and I did not receive an E-Mail to notify me?
> 
> the other tools work very well
> I may receive door openings or “power outages”.
> 
> but for the CPU_TEMP I receive nothing
> 
> Is it possible that there have been changes?
> 
> how to get it working again with the heat coming soon
> 
> thank you and good evening
> 
> /etc/asterisk/local/cpu_temp.sh
> 
> 
> 
> #!/bin/bash
> #
> # EXAMPLE Script pour envoyé des  email ou des  SMS si
> # CPU temperature depase la temperature  maximum.
> # The ssmtp package must be installed and configured
> 
> #  3/2019
> 
> # Maximum CPU Temperature in Degrees C
> MAXTEMP="45"
> 
> # Destination SMS number and address – CHANGE THIS!
> 
> RECEIVER="ldrolet at cgocable.ca"
> 
> 
> # How often to alert if temperature is exceeded - Default 30 Minutes
> ALERT_INTERVAL="30m"
> 
> function send_mail_warning() {
> echo -e "Subject: ATTENTION CPU Haute Temp\nTo: $RECEIVER\n\nATTENTION Temperature du CPU
> $CTEMP C au site du $HOSTNAME" | sendmail -t
> }
> 
> function send_mail_OK() {
> echo -e "Subject: CPU Temp est OK\nTo: $RECEIVER\n\nCPU Temperature OK 
> $CTEMP C au site du $HOSTNAME" | sendmail -t
> }
> 
> while :
> do
> PTEMP=`cat /sys/class/thermal/thermal_zone0/temp`
> CTEMP=`expr $PTEMP / 1000`
> echo -n $CTEMP
> echo -n "C / "
> FTEMP=`expr 9 '*' $CTEMP / 5 + 32`
> echo -n "$FTEMP"
> echo "F"
> if [ $CTEMP -gt $MAXTEMP ]
> then
> echo "Sending temperature warning message - CPU $CTEMP C"
> send_mail_warning
> while [ $CTEMP -gt $MAXTEMP ]
> do
> sleep $ALERT_INTERVAL
> 
> 
> PTEMP=`cat /sys/class/thermal/thermal_zone0/temp`
> CTEMP=`expr $PTEMP / 1000`
> 
> 
> if [ $CTEMP -le $MAXTEMP ]
> then
> echo "CPU Temperature Normal $CTEMP C"
> send_mail_OK
> 
> break
> else
> echo "Sending temperature warning message - CPU $CTEMP C"
> send_mail_warning
> fi
> done
> fi
> sleep 30
> done
> 
> 
> 
> 
> Luc Drolet VE2 LUQ
> Président de VE2CVA
> C.R.A.V.A.
> Club Radio Amateur Vallée de l'Amiante
> VE2 CVA
> ve2cva at gmail.com
> ldrolet at cgocable.ca
> https://clubs.raqi.ca/ve2cva/
> https://www.facebook.com/groups/ve2cva
> Instagram : https://www.instagram.com/ve2cva/
> Echolink =   VE2RVA-R    NODE #24560
> Sécurité Civil du Québec, Node #1400
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> 
> ARM-allstar mailing list
> ARM-allstar at hamvoip.org
> http://lists.hamvoip.org/cgi-bin/mailman/listinfo/arm-allstar
> 
> Visit the BBB and RPi2/3/4 web page - http://hamvoip.org



More information about the ARM-allstar mailing list