How To Debug Your Cronjobs

How To Debug Your Cronjobs

Recently I needed to debug a cronjob I have setup. It is not as easy as just running the job sometimes you need to know exactly where the error is coming from.

I find this the easiest way by far to find out what going on.

Create a cronjob time for every minute and pipe the output to an error log file.

* * * * * /home/bitnami/ >> /home/bitnami/cron_errors.log 2>&1

You can then tail the log file and wait for the cron to run.

tail -f cron_errors.log

This will then display your logs.

/home/bitnami/ line 9: ./ No such file or directory

Leave a comment