backup-containers/backup/backup.sh
2024-07-03 00:09:17 -07:00

15 lines
273 B
Bash

#!/bin/bash
source /.env
FILENAME="$NAME $(date +%Y-%m-%d\ %H-%M).tgz"
DIRNAME = "/tmp/$(date +%Y\/%m)"
# tar volumes
tar -aczf "$DIRNAME/$FILENAME" -C /volumes .
# ship to host
cd /tmp
rsync -r -e "ssh -i /id" . $NAME@$HOST:/home/$NAME/
# delete backup
rm -rf $DIRNAME