summaryrefslogtreecommitdiff
path: root/backup-dataset.sh
diff options
context:
space:
mode:
authorroot2017-05-17 04:06:27 +0200
committerroot2017-05-17 04:06:27 +0200
commit5bdbcea22a55979bcd4aa21aa4f76c9b818e1511 (patch)
tree06ab275a2bf501768b0bdf4a9f843c4b2c1c3bd0 /backup-dataset.sh
parent118ff790598aebf3c3f11a2ed73f0c842ae83e9c (diff)
downloadserver-utilities-5bdbcea22a55979bcd4aa21aa4f76c9b818e1511.tar.gz
Add backup scripts
Diffstat (limited to 'backup-dataset.sh')
-rwxr-xr-xbackup-dataset.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/backup-dataset.sh b/backup-dataset.sh
new file mode 100755
index 0000000..e4303c5
--- /dev/null
+++ b/backup-dataset.sh
@@ -0,0 +1,27 @@
1#!/bin/sh -euf
2
3SNAPSHOT_DIRECTORY="/var/backups/dataset-snapshots"
4
5usage() (
6 echo "backup-dataset.sh <dataset> <duplicity destination> [duplicity options]"
7 echo
8 echo "Performs a duplicity incremental backup of the specified dataset."
9 echo "An atomic snapshot of the dataset is taken prior to backing up."
10 echo
11)
12
13backup_dataset() (
14 DATASET="$1"
15 DESTINATION="$2"
16 DUPLICITY_OPTIONS="$3"
17
18 sudo snap.sh snap "$DATASET"
19 PASSPHRASE="null" duplicity $DUPLICITY_OPTIONS "$SNAPSHOT_DIRECTORY/$DATASET" "$DESTINATION"
20 sudo snap.sh free "$DATASET"
21)
22
23case "${1:-help}" in
24 "help") usage;;
25 *) backup_dataset "$1" "$2" "${3:-}";;
26esac
27