backups into a date named dir
This commit is contained in:
parent
b664813b52
commit
ee5b997d2a
@ -28,7 +28,7 @@ if [ -d "volumes/postgres" ]; then
|
|||||||
DB_USER=$(nerdctl exec $CONTAINER_NAME bash -c 'echo "$POSTGRES_USER"')
|
DB_USER=$(nerdctl exec $CONTAINER_NAME bash -c 'echo "$POSTGRES_USER"')
|
||||||
DB_PASSWORD=$(nerdctl exec $CONTAINER_NAME bash -c 'echo "$POSTGRES_PASSWORD"')
|
DB_PASSWORD=$(nerdctl exec $CONTAINER_NAME bash -c 'echo "$POSTGRES_PASSWORD"')
|
||||||
DB_NAME=$(nerdctl exec $CONTAINER_NAME bash -c 'echo "$POSTGRES_DATABASE"')
|
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
|
if [ -f "volumes/*.sql" ]; then
|
||||||
rm volumes/*.sql
|
rm volumes/*.sql
|
||||||
fi
|
fi
|
||||||
@ -37,6 +37,7 @@ fi
|
|||||||
|
|
||||||
# Compress all volumes excerpt mysql and postgres into the storage box (pubkey needed)
|
# Compress all volumes excerpt mysql and postgres into the storage box (pubkey needed)
|
||||||
BACKUP=${PWD##*/}.tar.zst
|
BACKUP=${PWD##*/}.tar.zst
|
||||||
tar --zstd -cf $BACKUP -C volumes /tmp
|
tar --zstd cf /tmp/$BACKUP -C volumes .
|
||||||
scp /tmp/$BACKUP u442569@u442569.your-storagebox.de
|
TODAY=$(date +%F)
|
||||||
|
scp -r /tmp/$BACKUP u442569@u442569.your-storagebox.de:$TODAY/$BACKUP
|
||||||
rm /tmp/$BACKUP
|
rm /tmp/$BACKUP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user