I am trying to repeatedly execute python script(s) using Cron. I have written a shell script that calls that/these python script(s). I have made the shell script as an executable and works perfect both in terminal and just by clicking to execute.
I have changed the crowntab to call my shell script at a specific - usually in a minute or two - time intervals to see if it is working. However, it seems my script is not being executed properly.
My python script is a long one and it also has local python functions that it calls. Nevertheless, I created a short python program as well as a shell script to call it for the purpose of finding out if the cron works and, it seems, that it is being called as intended.
Why my python/shell script is not being called properly for execution? If I call a shell script, do I still need to include path for the cron to see?
20 13 * * * /my/full/path/to/the/shell_script.sh
My shell script/file:
#!/bin/bash cd /full/path/to/the/python_script_folder sudo python3 python_script.py argument
Jan 23 20:13:01 raspberrypi cron: (pi) RELOAD (crontabs/pi) Jan 23 20:13:01 raspberrypi CRON: (root) CMD (/etc/myDevices/crontab.sh) Jan 23 20:13:01 raspberrypi CRON: (pi) CMD (/my/full/path/to/the/shell_script.sh)
Any help is appreciated. If you need any additional information, please let me know. Thank you.