Is this cronjob not working

croncronjobcrontabruby

I have a ruby script in ~/custom_scripts/get_all_products.rb.

I want it to run every night at 04:00.

Here's what the cronjob in crontab -e looks like:

MAILTO="<email>"
0 4 * * * ruby ~/custom_scripts/get_all_products.rb

But it's not executing.

What should I try next?

Best Answer

I've had issues with using tilde expansion in crontabs in the past (this may have been on a Unix flavor other than Linux). Still, I'd suggest using $HOME instead of ~.

Also, it's best to specify a full path to your ruby executable. The PATH used by cron is often not the one you have set in your interactive environment (e.g., on my system, the cron PATH is just /usr/bin:/bin).

Related Question