Last active
April 7, 2021 08:46
-
-
Save PatelUtkarsh/b9c4b07bd6442ae284d897baf75e70d3 to your computer and use it in GitHub Desktop.
Setup cron to monitor raspberry pi temperature
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage ./temperature_cron.sh $HOME/pi-temp-log | |
timestamp=`date +%F` | |
temp=`/opt/vc/bin/vcgencmd measure_temp` | |
temp=${temp:5:16} | |
mkdir -p $1 # make sure dir exists | |
echo "$(date +%H:%M:%S) = $temp" >> $1/temperature_log_$timestamp.txt # create new file for each day. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To log temp every 5 mins steps:
crontab -e
edit linux cron tab.nano
editor if you're doing it for the first time.*/5 * * * * $HOME/script/path/temperature_cron.sh $HOME/pi-temp-log
tail -f $HOME/pi-temp-log/*