summaryrefslogtreecommitdiff
path: root/baserock_backup
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-05-20 13:27:38 +0100
committerBaserock Gerrit <gerrit@baserock.org>2015-05-22 11:26:02 +0000
commit34ce43225daac688e94960e5ecbf9f9c79208963 (patch)
tree3d4fe95d9fe831ca3df31722e0f043567c0b9be3 /baserock_backup
parentd84c2ad127e12a43b6095db8a41678f8a1cc3662 (diff)
downloadinfrastructure-34ce43225daac688e94960e5ecbf9f9c79208963.tar.gz
baserock_backup: Make backups run automatically
This should have happened already, but I forgot that 'crond' won't be running automatically. The backup VM hosted at Codethink was powered off and back on at some point, backups didn't run after that point. Change-Id: I10f6b73c2947631001040099074f373a9ea5464e
Diffstat (limited to 'baserock_backup')
-rw-r--r--baserock_backup/crond.service18
-rw-r--r--baserock_backup/instance-config.yml9
2 files changed, 27 insertions, 0 deletions
diff --git a/baserock_backup/crond.service b/baserock_backup/crond.service
new file mode 100644
index 00000000..07efb807
--- /dev/null
+++ b/baserock_backup/crond.service
@@ -0,0 +1,18 @@
+# Busybox Cron is used to run the 'baserock-backup' script.
+#
+# It'd be better to run that script using a systemd timer unit, but the
+# script didn't work when run by systemd, when I last tested it. Seems like
+# it does something clever to stdin/stdout which breaks the clever thing
+# baserock-backup does with rsync.
+
+[Unit]
+Description=Busybox Cron daemon
+Requires=local-fs.target
+After=local-fs.target
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/crond -f
+
+[Install]
+WantedBy=multi-user.target
diff --git a/baserock_backup/instance-config.yml b/baserock_backup/instance-config.yml
index 327b84e9..8ccbb584 100644
--- a/baserock_backup/instance-config.yml
+++ b/baserock_backup/instance-config.yml
@@ -27,3 +27,12 @@
job: /home/backup/backup.sh
name: baserock.org data backup
user: backup
+
+ # As the .service file says, running the backup script via 'cron' is
+ # a workaround for what may be a bug in systemd. I don't have the energy
+ # to investigate the problem right now.
+ - name: .service file for Busybox 'cron' daemon
+ copy: src=crond.service dest=/etc/systemd/system mode=644
+
+ - name: service for Busybox 'cron' daemon
+ service: name=crond enabled=yes state=started