3

I'm using Amazon Linux and trying to run a cron job from my home directory (I don't have sudo permissions on the machine). I'm setting a cron job by executing crontab -e and adding this line

30 18 * * * /home/myuser/run_my_script.sh

within it. However, I'm observing that things don't seem to be running, so I wanted to figure out why. But running this

[myuser@mymachine ~]$ tail /var/log/cron
tail: cannot open ‘/var/log/cron’ for reading: Permission denied

doesn't help. How can I figure out why things aren't running, or rahter where things are breaking down in my script?

4

Add to the end of your cron table entry: >> /home/myuser/myscript.log 2>&1

This will capture the output to a log file. By default, the output is mailed using the local mailer daemon to the user who owns the job, but I am not certain this daemon is running by default on an AWS instance. If it is, try running mail as the user owning the job; you might have some messages waiting for you with the output for which you are looking.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.