I put together a python script that takes the output of a command and emails it to me every morning at 8. When running it manually, it runs fine, however when my cron runs it I receive the following:
Traceback (most recent call last):
File "/root/backup-mailer.py", line 50, in <module>
backups = json.loads(subprocess.check_output(['restic', 'snapshots', '--json']))
File "/usr/lib64/python2.7/subprocess.py", line 568, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Is it /usr/lib64/python2.7/subprocess.py
that it's having issues with?
My crontab:
0 8 * * * . /root/.restic-env; /usr/bin/python /root/backup-mailer.py
I know . /root/.restic-env;
runs fine because I use it in another cron which is successful. I've also ran /usr/bin/python /root/backup-mailer.py
which executes fine. As I say, it's only when it's ran as a cron that it fails.
Any suggestions? Thanks