Current location

narf Source control manager Git

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Mehani <shtrom@ssji.net>2017-01-31 03:03:52 +0100
committerOlivier Mehani <shtrom@ssji.net>2017-01-31 03:03:52 +0100
commiteaba4e57f3b0ab4ab6ac6b3de46ef197b2ab0b90 (patch)
tree3c37ca7dee4aea9816f799fa962f7a65b00b22de
parent5e807c6227285e55f2a75adeb4706096756f6629 (diff)
[backup.sh] Cleanup old backups
Signed-off-by: Olivier Mehani <shtrom@ssji.net>
-rwxr-xr-xopenbsd/backup.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/openbsd/backup.sh b/openbsd/backup.sh
index b7a190c..91bc3e8 100755
--- a/openbsd/backup.sh
+++ b/openbsd/backup.sh
@@ -6,6 +6,7 @@ TMPSUBDIR=/tmp
BACKUPROOT="/srv/rdiff-backup"
BACKUPDIR="${BACKUPROOT}/`hostname -s`"
BACKUPSERVER=backup.example.net
+BACKUPHORIZON="2Y"
REMOTEBACKUPDIR="`hostname -s`@${BACKUPSERVER}::${BACKUPDIR}"
EXCLUDEALWAYS="${BACKUPROOT}"
@@ -73,4 +74,13 @@ for DIR in ${DIRS}; do
done
/usr/local/bin/rdiff-backup --create-full-path ${REMOTESCHEMA:+--remote-schema "${REMOTESCHEMA}"} ${TMPSUBDIR:+--tempdir ${BACKUPDIR}${TMPSUBDIR}} ${TMPSUBDIRxxxDISABLED:+--remote-tempdir /share/homes/`hostname -s`${TMPSUBDIR}} ${EXCLS} ${DIR} ${EFFECTIVEBACKUPDIR}${DIR}
done
+
+if [ -n "${BACKUPHORIZON}" ]; then
+ echo -n "Cleaning up backups older than ${BACKUPHORIZON} from ${EFFECTIVEBACKUPDIR}:"
+ for DIR in ${DIRS}; do
+ echo -n " ${DIR}"
+ /usr/local/bin/rdiff-backup --remove-older-than ${BACKUPHORIZON} ${REMOTESCHEMA:+--remote-schema "${REMOTESCHEMA}"} ${EFFECTIVEBACKUPDIR}${DIR}
+ done
+fi
+
echo "."