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.
One thought on - 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
CentOS mailing list CentOS@CentOS.org https://lists.CentOS.org/mailman/listinfo/CentOS