aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/cleanup.rake20
-rw-r--r--lib/tasks/config_files.rake5
2 files changed, 23 insertions, 2 deletions
diff --git a/lib/tasks/cleanup.rake b/lib/tasks/cleanup.rake
new file mode 100644
index 000000000..9a8be9521
--- /dev/null
+++ b/lib/tasks/cleanup.rake
@@ -0,0 +1,20 @@
+namespace :cleanup do
+
+ desc 'Clean up all message redelivery and destroy actions from the holding pen to make admin actions there faster'
+ task :holding_pen => :environment do
+ dryrun = ENV['DRYRUN'] != '0'
+ if dryrun
+ $stderr.puts "This is a dryrun - nothing will be deleted"
+ end
+ holding_pen = InfoRequest.find_by_url_title('holding_pen')
+ old_events = holding_pen.info_request_events.find_each(:conditions => ['event_type in (?)',
+ ['redeliver_incoming',
+ 'destroy_incoming']]) do |event|
+ puts event.inspect
+ if ! dryrun
+ event.destroy
+ end
+ end
+ end
+
+end
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