I have a script which download and compress a folder of a remote server (example: /home).
I m trying to make the "restore" script, but I have a strange behavior.
($1 is IP adress, $2 is full path)
if [ $# -lt 2 ] then echo "Error" exit 1 else D=$(mktemp -d) echo "From $D/$2" echo "To user@$1:/$2" tar xfz /backup/$1.tar.gz -C $D rsync -ncavzPe ssh --partial --delete $D/$2 user@$1:/$2 rm -r $D exit 0 fi
Let s say the remote server is 127.0.0.12, and I want to restore /home.
$ssh 127.0.0.12 $password: $ls /home/user a b c x y z $logout $sh restore.sh 127.0.0.12 /home From /tmp/tmp.R8iAewFEIR//home To email@example.com://home firstname.lastname@example.org's password: sending incremental file list home/ home/user/ home/user/1 home/user/2 home/user/.cache/ home/user/.cache/motd.legal-displayed sent 351 bytes received 40 bytes 46.00 bytes/sec total size is 0 speedup is 0.00 (DRY RUN) $
Isn t it supposed to delete a, b, c, x, y and z? Is it just because of the dry-run? Is it sending to another folder? I broke a server trying similar things yesterday and am too afraid to try it without the -n.