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