backups into a date named dir

This commit is contained in:
julien 2025-01-19 15:32:06 +01:00
parent b664813b52
commit ee5b997d2a

View File

@ -28,7 +28,7 @@ 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_$(date +%F_%T).sql
DUMP_NAME=$CONTAINER_NAME
if [ -f "volumes/*.sql" ]; then
rm volumes/*.sql
fi
@ -37,6 +37,7 @@ fi
# Compress all volumes excerpt mysql and postgres into the storage box (pubkey needed)
BACKUP=${PWD##*/}.tar.zst
tar --zstd -cf $BACKUP -C volumes /tmp
scp /tmp/$BACKUP u442569@u442569.your-storagebox.de
tar --zstd cf /tmp/$BACKUP -C volumes .
TODAY=$(date +%F)
scp -r /tmp/$BACKUP u442569@u442569.your-storagebox.de:$TODAY/$BACKUP
rm /tmp/$BACKUP