Debugging cron

Alex Egg,

Say you setup this cron job to run your ruby script every 5 minutes:

*/5 * * * * ruby /home/ubuntu/seatcheck/seatcheck.rb

But you’re checking your logs and it doesn’t seem to be running….??? A good way to debug is to comment out your entry and add:

* * * * * env > /tmp/env.output

Then check the convents of env.output and then compare that to what you get when you run env in your shell.

Volla, and you’re sure to see that cron doesn’t have the same path as you do – so no ruby runtime.

A quick fix:

*/5 * * * * /usr/local/bin/ruby /home/ubuntu/seatcheck/seatcheck.rb

Permalink: debugging-cron


Last edited by Alex Egg, 2016-10-05 18:59:53
View Revision History