?

Log in

Wed, May. 7th, 2008, 02:06 pm
anotherthink: can't run a rails action with cron

I've been able to use cron with script/runner with other rails apps, no problem. Now I'm developing on an OpenSolaris box, and cron doesn't seem to be working -- I can see no evidence that the command was ever executed.

Here's my crontab:
59 17 * * * RAILS_ENV=development /full/path/to/script/runner ModelName.method_name > /full/path/to/cron.log

I've also tried:
59 17 * * * /full/path/to/script/runner -e development 'ModelName.method_name' > /full/path/to/cron.log

I'm able to execute non-Rails cron tasks, and from the command line,
/full/path/to/script/runner -e development 'ModelName.method_name'
works just fine.

No output ever gets written to cron.log.

I feel like this has got to be something dumb like permissions, but I can't think of what (the cron jobs run as the same user I've been able to use at the command line). Any suggestions?

Thanks!

Wed, May. 7th, 2008 06:19 pm (UTC)
cpm

Have you tried:
59 17 * * * RAILS_ENV=development /full/path/to/ruby /full/path/to/script/runner ModelName.method_name > /full/path/to/cron.log

Perhaps PATH isn't getting setup properly when running from cron. My copy of script/runner uses /usr/bin/env to find ruby.

Wed, May. 7th, 2008 06:31 pm (UTC)
anotherthink

Worked perfectly -- thank you!!