It seems what we've got here is one of those rare cases when cron job doesn't run.
Here's how I would tackle this problem.
I would run python /home/ec2-user/monitoring/job.py >> /var/log/script_output.log 2>&1
in bash. Just to check that the command can run in normal circumstances.
I would add MAILTO=your@email. Just to get emails when something goes wrong.
I would run which python
command and use full path to python
in the cron file. Let's say which python
returned /usr/bin/python. Then I would edit cron file like this:
*/5 * * * * /usr/bin/python /home/ec2-user/monitoring/job.py >> /var/log/script_output.log 2>&1
I would append an empty line to the cron file. Actually I would do this first. But I'm stuck on FreeBSD's default cron. You're probably running Ubuntu and using Vixie Cron. Couldn't hurt anyway.
I would run pgrep cron
in bash. Just to check that cron daemon is well and running.
In the end your cron should look like this:
MAILTO=my@email.com
*/5 * * * * /usr/bin/python /home/ec2-user/monitoring/job.py >> /var/log/script_output.log 2>&1