RafaĆ Radecki
2016-Oct-27 09:47 UTC
[CentOS] python script from crontab - problems with proper execution
Hi All. I currently have a problem with proper invocation of a python script with cron. non-root $ crontab -l #Ansible: script_repo_scanner 55 11 * * * /usr/bin/python /path/script_repo_scanner.py --bb_user bb_user --bb_pass bb_pass --bd_log_dir /path/logs &> /path/script_repo_scanner.py.log And in /var/log/cron I see that cron executed the script but there is no log output in /path/script_repo_scanner.py.log and the script did not perform his job. So it looks like it has not been run despite entries in /var/log/cron ;) When I execute the command non-root$ /usr/bin/python /path/script_repo_scanner.py --bb_user bb_user --bb_pass bb_pass --bd_log_dir /path/logs &> /path/script_repo_scanner.py.log I get standard output (script logs to stdout) and script does its job. Any clue what I could be missing? BR, Rafal.
Brian Bernard
2016-Oct-27 12:25 UTC
[CentOS] python script from crontab - problems with proper execution
Hi Rafal, You'll want to change the command to /usr/bin/python /path/script_repo_scanner.py --bb_user bb_user --bb_pass bb_pass --bd_log_dir /path/logs >> /path/script_repo_scanner.py.log Notice that &> is changed to >> Take care, Brian Bernard On Thu, Oct 27, 2016 at 5:47 AM, Rafa? Radecki <radecki.rafal at gmail.com> wrote:> Hi All. > > I currently have a problem with proper invocation of a python script with > cron. > > non-root $ crontab -l > #Ansible: script_repo_scanner > 55 11 * * * /usr/bin/python /path/script_repo_scanner.py --bb_user bb_user > --bb_pass bb_pass --bd_log_dir /path/logs &> > /path/script_repo_scanner.py.log > > And in /var/log/cron I see that cron executed the script but there is no > log output in /path/script_repo_scanner.py.log and the script did not > perform his job. So it looks like it has not been run despite entries in > /var/log/cron ;) > > When I execute the command > > non-root$ /usr/bin/python /path/script_repo_scanner.py --bb_user bb_user > --bb_pass bb_pass --bd_log_dir /path/logs &> > /path/script_repo_scanner.py.log > > I get standard output (script logs to stdout) and script does its job. > > Any clue what I could be missing? > > BR, > Rafal. > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos >