with command
/opt/vc/bin/vcgencmd measure_temp
obtain
pi@mypi:~ $ /opt/vc/bin/vcgencmd measure_temp
temp=47.2'C
with command
/sys/class/thermal/thermal_zone0/temp
get a number representing the temperature multiplied by 1000
script for upload with ftp a log of cpu temperature (file located on /hom/pi/script/)
sudo vi /home/pi/script/uploadtemp.sh
insert this ins
temp=$(cat /sys/class/thermal/thermal_zone0/temp)
datacorr=$(date +%d/%m/%Y)
oracor=$(date +%H:%M:%S%n)
echo "$temp;$datacorr;$oracor">> /home/pi/script/temp.csv
HOST='ftp.mydomain.com'
USER='mylogin'
PASSWD='mypassword'
FILE='/home/pi/script/temp.csv /mydomain.com/temp.txt'
ftp -n $HOST <
quote PASS $PASSWD
binary
put $FILE
quit
END_SCRIPT
exit 0
save script
:w
:q
make executable
sudo chmod +x myscript.sh
with add a crontab entry (log and upload every 15 min to ftp)
sudo vi /etc/crontab
0,15,30,45 * * * * root sh /home/pi/script/uploadtemp.sh &>/dev/null
Nessun commento:
Posta un commento