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