I’m trying to set up a cronjob to measure the temperature of my pi and then report it to a DB by hitting a URL on another pi.
I’ve successfully set this up on a pure raspbian system but it seems to fail in OSMC.
The python script is:
import psutil, os, urllib2 res = os.popen('vcgencmd measure_temp').readline() CPUtemp = float(res.replace("temp=","").replace("'C\n","")) response = urllib2.urlopen('http://10.0.0.10/app/IntTemp/?temp='+str(CPUtemp)+'&sensor=temp').read() if response == "Error!": print "Error!"
The crontab is:
*/10 * * * * /usr/bin/python /home/osmc/temperature.py >/tmp/test.log 2>&1
The script runs and records in the DB outside of the cronjob, the python script also works outside of the cronjob. The /usr/bin/python /home/osmc/temperature.py section also works independently
What have I missed?