Cron

Hi, can someone help me with cron?

I made a simple bash script for saving temperature to mysql:
#!/bin/bash

a=$(vcgencmd measure_temp | grep temp= | sed -r ‘s/[^0-9]+//g’)
temp=$(($a / 10))

query=“INSERT INTO teploty.tep_osmc(time, cpu) values (NOW(), “$temp”);”
echo $query | mysql -u kodi -pPassWord -h 192.168.55.1

I put this script in /bin
I made chmod a+x temperature.sh

After that if i do this:
osmc@osmc:~$ temperature.sh

It simply save temperature to my mysql database od my server.

It work good from command line, but it does not work from cron.
I try this:
root@osmc:~# crontab -e
there i put: * * * * * temperature

and save and it does not work.
I try make some changes and it still not work.
Have someone some idea?

Now I find app “Cron Task Scheduler” in osmc app store, but if I install it, i can not find any user interface of this app? How can i use this app?¨
Thanks and sorry for my bad english

There is no UI… Now that it’s installed, use crontab as normal.

This line is not right. You have quotes within quotes. And what is the _ at the end of the line?
[EDIT] I just re-read and the quotes are OK. But what’s with the _

Check your log files to see any errors that cron is generating.

and if it still fails then try putting in the full path to the script in the cron line.

Thank everyone for reply, the problem was this:

I made alias “/opt/vc/bin/vcgencmd measure_temp” to “vcgencmd measuretemp”
If i run script manualy, it work, but it does not work from cron.
After i change line from: “a=$(vcgencmd measuretemp | grep temp= | sed -r ‘s/[^0-9]+//g’)” to: “a=$(/opt/vc/bin/vcgencmd measure_temp | grep temp= | sed -r ‘s/[^0-9]+//g’)” it start work. Thank you

I had a similar problem, and found that root & osmc users have different cron jobs, and the root one on my system didn’t work as expected - log in as osmc and add the line to crontab -e and see if that helps. Also as said earlier, use the full path to the script.