blob: 3ad3972aa526aa79f066809b2bb3c77b1c0f7c6d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#!/bin/bash
set -eu
usage () {
echo
echo Usage: ./backup.sh [-h, --help]
echo
echo This utility extracts a TAR backup of data and logs
echo produced by the Taler services running inside this Docker
echo Compose setup. The backup is saved in /tmp/YYYY-MM-DD-taler-backup.tar
}
for helpOpt in "-h" "--help"; do
if test "$helpOpt" = "${1:-}"; then
usage
exit 0
fi
done
if ! which docker > /dev/null; then
echo docker not found.
exit 1
fi
BACKUP_FILE="/tmp/$(date +%Y-%m-%d)-taler-backup.tar"
if test -a $BACKUP_FILE; then
echo "Backup file $BACKUP_FILE exists already, please move it and run the script again."
exit 3
fi
# 'chown' should still help rootful runs to
# have the TAR owned by the user invoking the command.
docker run \
-v /tmp:/tmp \
-v demo_talerdata:/taler-data \
-v demo_talerlogs:/taler-logs \
-it debian:stable \
/bin/bash -c "tar --no-same-owner --no-same-permissions -c -f ${BACKUP_FILE} /taler-data /taler-logs" > /dev/null
echo Backup at: ${BACKUP_FILE}
|