rewrites the whole thing
This commit is contained in:
27
backup.sh
Executable file
27
backup.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
|
||||
if [ ! -f "${PWD}/.env" ]; then
|
||||
echo "missing env file in ${PWD}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -a
|
||||
. "${PWD}/.env"
|
||||
set +a
|
||||
|
||||
now="$(date +%Y-%m_%d-%H-%M-%S)"
|
||||
backup_path="${PWD}/backup-volumes/${now}"
|
||||
mkdir -p "${backup_path}"
|
||||
|
||||
volumes="db traefik-dynamic traefik-certs traefik-logs traefik-static webroot"
|
||||
|
||||
for volume in ${volumes}; do
|
||||
mkdir -p "${backup_path}/${volume}"
|
||||
docker run \
|
||||
--rm \
|
||||
--volume "${backup_path}/${volume}":/destination \
|
||||
--volume "${PREFIX}-${volume}:/${volume}" \
|
||||
ubuntu \
|
||||
tar -cvzf "/destination/${volume}.tar.gz" -C "/${volume}" .
|
||||
done
|
||||
Reference in New Issue
Block a user