Take the 2-minute tour ×

Sorry quick question here from a relative Rails newbie. I'm trying to use the Whenever gem to schedule a number of rake tasks. I can't for the life of me get it to actually begin running the cron jobs on my development machine.

Judging from other stackoverflow threads, it appears I should add this:

set :environment, "development"

to my schedule.rb file. But then what?

And then how do I stop the cron jobs once they've started?

Using Rails 3.2.3 in OSX

UPDATE: the answer is to run $ whenever -w which writes the cron job to a crontab file. The system then immediately starts running that crontab file automatically.

Unfortunately, my logfile for whenever contains the following: "rake aborted! Don't know how to build task <task name>"

I'm thinking this might be due to the known crontab/rvm issue, but any suggestions are welcome.

share|improve this question
add comment

3 Answers

crontab -r
whenever --update-crontab --set environment='development'
share|improve this answer
add comment

You can use the whenever command and its various options to manipulate your crontab.

$ whenever --help
Usage: whenever [options]
    -i [identifier],                 Default: full path to schedule.rb file
    -w, --write-crontab [identifier] Default: full path to schedule.rb file
    -c, --clear-crontab [identifier]
    -s, --set [variables]            Example: --set 'environment=staging&path=/my/sweet/path'
    -f, --load-file [schedule file]  Default: config/schedule.rb
    -u, --user [user]                Default: current user
    -k, --cut [lines]                Cut lines from the top of the cronfile
    -v, --version
share|improve this answer
Thanks. What I didn't realize was that once you write to the crontab file using whenever -w, the crontab start running automatically (i.e. you don't have to do anything else to execute it.) Unfortunately, my logfile for whenever says "rake aborted! Don't know how to build task <task name>" The rake task works on its own just using $ rake from the command prompt. Any suggestions? –  user1377556 Jul 17 '12 at 5:31
You probably have incorrect syntax somewhere in the task or whenever event. Try to get a more informative stack trace. –  Conner Jul 17 '12 at 11:14
Doing some searching around, it appears this may be an issue with RVM, which apparently has some problems with Whenever. Any suggestions on this would be most appreciated. –  user1377556 Jul 18 '12 at 5:10
add comment
whenever -c cron-name  #removing cronjobs 
share|improve this answer
add comment

Your Answer


