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?My crontab:20 13 * * * /my/full/path/to/the/shell_script.shMy shell script/file:#!/bin/bashcd /full/path/to/the/python_script_foldersudo python3 python_script.py argumentRPi3 /var/log/syslog:Jan 23 20:13:01 raspberrypi cron[477]: (pi) RELOAD (crontabs/pi)Jan 23 20:13:01 raspberrypi CRON[3851]: (root) CMD (/etc/myDevices/crontab.sh)Jan 23 20:13:01 raspberrypi CRON[3854]: (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.
Cron calling a shell script that calls a python script [RPi3]
shell script;cron;python;raspberry pi
As @thrig mentioned - sudo is probably asking for password and bash -x will give additional info of what is executed and what is the output.First of all, it's a good practice to redirect cron output, e.g. 20 13 * * * /my/full/path/to/the/shell_script.sh > ${HOME}/cron.log 2>&1This will give you output of the script logged in the file. I would:place the entry in crontab of the user that needs to run it.drop the wrapper and set the command as 'python3 /path/to/script.py args'