Last Updated: February 25, 2016
· eggie5

Debugging cron

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