From 3d071c9f0adf21e7525d659c6a92af2699866a6a Mon Sep 17 00:00:00 2001 From: julien Date: Sun, 19 Jan 2025 15:38:05 +0100 Subject: [PATCH] test --- sbin/vol-compress | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/sbin/vol-compress b/sbin/vol-compress index 8fab465..143893c 100644 --- a/sbin/vol-compress +++ b/sbin/vol-compress @@ -15,10 +15,7 @@ if [ -d "volumes/mysql" ]; then DB_USER=$(nerdctl exec $CONTAINER_NAME bash -c 'echo "$MYSQL_USER"') DB_PASSWORD=$(nerdctl exec $CONTAINER_NAME bash -c 'echo "$MYSQL_PASSWORD"') DB_NAME=$(nerdctl exec $CONTAINER_NAME bash -c 'echo "$MYSQL_DATABASE"') - DUMP_NAME=$CONTAINER_NAME_$(date +%F_%T).sql - if [ -f "volumes/*.sql" ]; then - rm volumes/*.sql - fi + DUMP_NAME=$CONTAINER_NAME.sql nerdctl exec -e MYSQL_PWD=$DB_PASSWORD $CONTAINER_NAME mariadb-dump -u $DB_USER $DB_NAME > volumes/$DUMP_NAME fi @@ -28,16 +25,14 @@ if [ -d "volumes/postgres" ]; then DB_USER=$(nerdctl exec $CONTAINER_NAME bash -c 'echo "$POSTGRES_USER"') DB_PASSWORD=$(nerdctl exec $CONTAINER_NAME bash -c 'echo "$POSTGRES_PASSWORD"') DB_NAME=$(nerdctl exec $CONTAINER_NAME bash -c 'echo "$POSTGRES_DATABASE"') - DUMP_NAME=$CONTAINER_NAME - if [ -f "volumes/*.sql" ]; then - rm volumes/*.sql - fi + DUMP_NAME=$CONTAINER_NAME.sql nerdctl exec -e $CONTAINER_NAME pg_dump -U $DB_USER $DB_NAME > volumes/$DUMP_NAME fi # Compress all volumes excerpt mysql and postgres into the storage box (pubkey needed) BACKUP=${PWD##*/}.tar.zst tar --zstd -cf /tmp/$BACKUP -C volumes . +rm volumes/$DUMP_NAME TODAY=$(date +%F) -scp -r /tmp/$BACKUP u442569@u442569.your-storagebox.de:$TODAY/$BACKUP +scp -r /tmp/$BACKUP u442569@u442569.your-storagebox.de:/$TODAY/$BACKUP rm /tmp/$BACKUP