commit c9fa83c11464d256443d5cb5986bd1a61bcf97cc
parent 345a104c5e89fd6c2e5136e8baccc78abd2ef796
Author: Chris Bracken <chris@bracken.jp>
Date: Fri, 10 May 2024 21:21:02 +0900
Add comment to backup script, fail on error
During partial internet outages, the backup may end up partially
completed then continue on with a half-baked backup. We now fail
immediately on error so we don't collect bad backups and roll good ones
out of retention.
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/backup_git.bracken.jp.sh b/backup_git.bracken.jp.sh
@@ -1,5 +1,15 @@
#!/bin/sh
+# Backup script for git repos, typically invoked via a cron job on the backup
+# server.
+#
+# Invoke with a backup tag, typically "daily", "weekly", "monthly" and the
+# number of previous backups to be retained. Older backups that fall out of
+# retention are deleted.
+
+# Fail if any step fails, so we don't collect half-baked backups.
+set -e
+
TAG=$1
RETAIN_COUNT=$2