If you use cron, be sure to make all external command with full path.bran2000 wrote:the same for me the script works fine but not the crontab, any idea ?gennapium wrote:Hi,
I tested the script and when i start it it works fine. But when starting the script in cron, nothing happens. I can see the output.tx file is being updated but the info in the html page of domoticz is not updated. Also starting with sudo in cron doesn't help.
Does anyone know why ?
So replace ping with
/bin/ping
Replace curl with
/usr/bin/curl
Replace speedtest-cli with
/usr/bin/speedtest-cli
This is the short answer.
The long answer is that cron will passes a minimal set of environment variables to your jobs. In most cases it will not know the current PATH, so it will not find the external commands. There are lots of ways how to work around this, but if you use the full path, it will just work.
p.s. if you don't know the full path, just type in "which {command}" and you will find the full path.