Bring mailman backup script under chef control
authorTom Hughes <tom@compton.nu>
Sun, 23 Jun 2013 09:41:17 +0000 (10:41 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 23 Jun 2013 09:41:17 +0000 (10:41 +0100)
cookbooks/mailman/recipes/default.rb
cookbooks/mailman/templates/default/backup.cron.erb [new file with mode: 0644]

index 05f1997..4013058 100644 (file)
@@ -32,3 +32,10 @@ apache_module "rewrite"
 apache_site "lists.openstreetmap.org" do
   template "apache.erb"
 end
+
+template "/etc/cron.daily/lists-backup" do
+  source "backup.cron.erb"
+  owner "root"
+  group "root"
+  mode 0755
+end
diff --git a/cookbooks/mailman/templates/default/backup.cron.erb b/cookbooks/mailman/templates/default/backup.cron.erb
new file mode 100644 (file)
index 0000000..486694a
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# DO NOT EDIT - This file is being maintained by Chef
+
+T=$(mktemp -d -t -p /var/tmp lists.XXXXXXXXXX)
+D=$(date +%Y-%m-%d)
+B=lists-$D.tar.gz
+
+mkdir $T/lists-$D
+ln -s /var/lib/mailman $T/lists-$D/mailman
+
+export GZIP="--rsyncable -9"
+
+nice tar --create --gzip --dereference --directory=$T --file=$T/$B lists-$D
+nice rsync $T/$B backup::backup
+
+rm -rf $T