aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tasks
diff options
context:
space:
mode:
authorGareth Rees <gareth@mysociety.org>2014-06-19 11:32:06 +0100
committerGareth Rees <gareth@mysociety.org>2014-06-25 11:34:38 +0100
commita6c11111cd7247511bea3f1de7c42ff5deaa1c3f (patch)
treebe011c0821d2d4d1bb7bf936bd47657de26792c6 /lib/tasks
parenta9389e60e3e2f912ef3131351ab37551a3929a2a (diff)
Add MAILTO option to convert_crontab task
Less manual editing for reinstallers. Existing backwards-compatibility: $ bundle exec rake config_files:convert_crontab \ DEPLOY_USER=deploy \ VHOST_DIR=/home/vagrant/ \ VCSPATH=alaveteli \ SITE=alaveteli \ CRONTAB=config/crontab-example | grep 'MAILTO=' MAILTO=cron-alaveteli@mysociety.org New optional MAILTO option: $ bundle exec rake config_files:convert_crontab \ DEPLOY_USER=deploy \ VHOST_DIR=/home/vagrant/ \ VCSPATH=alaveteli \ SITE=alaveteli CRONTAB=config/crontab-example \ MAILTO=cron@example.org | grep 'MAILTO=' MAILTO=cron@example.org
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/config_files.rake5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/tasks/config_files.rake b/lib/tasks/config_files.rake
index d0e4001f0..60814cb27 100644
--- a/lib/tasks/config_files.rake
+++ b/lib/tasks/config_files.rake
@@ -50,7 +50,7 @@ namespace :config_files do
desc 'Convert Debian .ugly crontab file in config to a form suitable for installing in /etc/cron.d'
task :convert_crontab => :environment do
- example = 'rake config_files:convert_crontab DEPLOY_USER=deploy VHOST_DIR=/dir/above/alaveteli VCSPATH=alaveteli SITE=alaveteli CRONTAB=config/crontab-example'
+ example = 'rake config_files:convert_crontab DEPLOY_USER=deploy VHOST_DIR=/dir/above/alaveteli VCSPATH=alaveteli SITE=alaveteli CRONTAB=config/crontab-example MAILTO=cron-alaveteli@example.org'
check_for_env_vars(['DEPLOY_USER',
'VHOST_DIR',
'VCSPATH',
@@ -60,7 +60,8 @@ namespace :config_files do
:user => ENV['DEPLOY_USER'],
:vhost_dir => ENV['VHOST_DIR'],
:vcspath => ENV['VCSPATH'],
- :site => ENV['SITE']
+ :site => ENV['SITE'],
+ :mailto => ENV.fetch('MAILTO') { "cron-#{ ENV['SITE'] }@mysociety.org" }
}
convert_ugly(ENV['CRONTAB'], replacements).each do |line|
puts line