]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/thinkup/templates/default/backup.cron.erb
Bring thinkup backup script under chef control
[chef.git] / cookbooks / thinkup / templates / default / backup.cron.erb
diff --git a/cookbooks/thinkup/templates/default/backup.cron.erb b/cookbooks/thinkup/templates/default/backup.cron.erb
new file mode 100644 (file)
index 0000000..b5b6c75
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# DO NOT EDIT - This file is being maintained by Chef
+
+T=$(mktemp -d -t -p /var/tmp thinkup.XXXXXXXXXX)
+D=$(date +%Y-%m-%d)
+B=thinkup-$D.tar.gz
+
+mkdir $T/thinkup-$D
+mysqldump --user=thinkup --password=<% @passwords["database"] %> --opt thinkup > $T/thinkup-$D/thinkup.sql
+ln -s /srv/thinkup.openstreetmap.org $T/thinkup-$D/www
+
+export GZIP="--rsyncable -9"
+
+nice tar --create --gzip --dereference --directory=$T --file=$T/$B thinkup-$D
+nice rsync $T/$B backup::backup
+
+rm -rf $T