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?
Yes, you can do this. You’ll just need to assign an identifier to the task being written to crontab:
It will generate an entry in crontab like this:
Then whenever you call the command above it will only update where it finds the identifier you specified.