diff options
author | Wolfgang Müller | 2019-10-03 14:06:30 +0200 |
---|---|---|
committer | Wolfgang Müller | 2019-10-03 14:06:30 +0200 |
commit | 7e4473b455500311239f4e529ff972ee21e47554 (patch) | |
tree | 173539f77420625dd3ed0c0b8ff2b47c6bc9de81 /lifeboat | |
download | lifeboat-7e4473b455500311239f4e529ff972ee21e47554.tar.gz |
Initial import0.1.0
Diffstat (limited to 'lifeboat')
-rwxr-xr-x | lifeboat | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lifeboat b/lifeboat new file mode 100755 index 0000000..244f732 --- /dev/null +++ b/lifeboat @@ -0,0 +1,41 @@ +#!/bin/sh + +set -e + +errx() { + printf "lifeboat: %s\n" "$1" >&2 + exit 1 +} + +usage() { + printf "usage: lifeboat repo [run|restic-cmd]\n" + exit 0 +} + +run_backup() { + ( + cd "$rootdir/$repo" + ./run + for i in post sync; do + test -x $i && ./$i + done + ) +} + +rootdir=${LIFEBOAT_ROOT:-"/srv/backup/lifeboat"} + +test $# -lt 2 && usage + +repo=$1 +shift + +test -d "$repo" || errx "$repo: no such repository" + +export LIFEBOAT_REPO_NAME=$repo +export RESTIC_REPOSITORY=$rootdir/$repo/repo +export RESTIC_PASSWORD_FILE=$rootdir/$repo/credentials/restic + +case "$1" in + run) run_backup;; + *) restic "$@";; +esac |