Saturday, April 27, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 4585  / 3 Years ago, sun, august 8, 2021, 12:52:25

I made a script that sends my local sensors temperature to a server in the internet and then I can see a graph of it. Everything works fine when I execute it manully. I have the latest ubuntu version.
When it comes to run periodically every minute with crontab then nothing works. It doesnt send anything. I tried to run it as SUDO and as user, I tried to add it in the crontab file to run it from several locations like /bin/myscript.sh , /user/Desktop and many others...Nothing seems to work.
Any Idea how to solve it?
Thank you!



   echo Init ... 
TEMP=`/usr/bin/snmpwalk -v 1 -c public 192.168.1.2 iso.3.6.1.4.1.38783.3.9.0 | cut -d" " -f4`
echo $TEMP


REALTEMP=`echo "scale=1; $TEMP/10" | bc -l`
echo $REALTEMP

echo
wget "http://api.thingspeak.com/update?key=MYKEY=$REALTEMP"

More From » scripts

 Answers
5

I had a similar issue getting cron to recognize a command on a server of mine. The tip that solved my issue came from the troubleshooting section of the Ubuntu Cron Howto:




When adding a new entry to a blank crontab, forgetting to add a
newline at the end is a common source for the job not running. If the
last line in the crontab does not end with a newline, no errors will
be reported at edit or runtime, but that line will never run. See man
crontab for more information. This has already been suggested as a
bug.



[#35656] Monday, August 9, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tionverflow

Total Points: 500
Total Questions: 115
Total Answers: 120

Location: Northern Ireland
Member since Mon, Nov 14, 2022
1 Year ago
;