What command do you set in your crontab file? Is the script intended to run once and done or constantly post power readings?
As you mention, crons can fail because of path issues. Not only for the script but also for python if that is how you are running the script. For example:
@reboot /usr/bin/python3 /home/pi/example.py
You may wish to save the output of ...
using the above system md may just need a little tweak if your python script uses paho.mqtt installed as python3 version
It's been a while since I've used raspistill, but this may work as a cron job:
Create your bash script at /home/pi/camera.sh as follows:
/usr/bin/raspistill -o /home/pi/camera/$DATE.jpg
Be sure to mark it as executable :
chmod a+x /home/pi/camera.sh
Add the following line to your crontab (crontab -e):
* * ...
Since you are using stdio, a fifo might be a solution for your input. For example, open two terminals and do:
terminal 1: |terminal 2:
$ mkfifo fifo |
$ tail -f fifo | sed 's/a/A/' |$ echo hoppa > fifo
So, you could create a fifo in your ...
If you want it to keep a process running so you can use it then install the screen program then use screen at the start command in the cron job. This is where you use the /usr/bin/screen -d -m -fa -S Screen_Name_For_Instance /usr/bin/name_of_server_program to start it up. You can test the command at your command line. Once happy it runs correctly then the ...
As you have to with cron if you had put a PATH= in your script it would have found the files. Cron does not inherit any PATH or other environment variables they need to be set or you use absolute paths to the files, as you discovered.
I found the problem.
Actually I was referring to some folders (the one where the files to upload are) with relative paths. It works when I run the script directly with python command, but not with Cron. So I updated all the paths with absolute values, and now it works :)