6

I am using:

  • Ruby 1.9.2
  • whenever 0.7.2
  • capistrano 2.9.0
  • capistrano-ext 1.2.1

I am using whenever in conjunction with Capistrano on deploys to manage my crontab files.

I noticed that it completely rewrites my crontab files each time.

I'd like to be able to set environment variables in cron to control PATH and MAILTO settings, which are regular cron environment variables.

Is there a way to make whenever not overwrite the entire crontab file, so that I can add customizations to my crontab file and be sure that they will persist?

1 Answer 1

12

Yes, you can do this. You'll just need to assign an identifier to the task being written to crontab:

whenever --update-crontab some_identifier_name

It will generate an entry in crontab like this:

# Begin Whenever generated tasks for: some_identifier_name
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /bin/bash -l -c 'cd /var/www/test/releases/20120416183153 && script/rails runner -e production '\''Model.some_method'\'' >> /tmp/cron_log.log 2>&1'

# End Whenever generated tasks for: some_identifier_name

Then whenever you call the command above it will only update where it finds the identifier you specified.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.