From: Christian Heller Date: Fri, 14 Dec 2018 23:21:14 +0000 (+0100) Subject: Add a script to mirror directory trees. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/static/%7B%7Bprefix%7D%7D/%7B%7Bdb.prefix%7D%7D/test?a=commitdiff_plain;h=75be7235258390736996362e04beda1650fc1b4a;p=config Add a script to mirror directory trees. --- diff --git a/all_new_2018/mirror_dir.sh b/all_new_2018/mirror_dir.sh new file mode 100755 index 0000000..688b2b8 --- /dev/null +++ b/all_new_2018/mirror_dir.sh @@ -0,0 +1,22 @@ +#!/bin/sh +set -e + +if [ $# -lt 2 ]; then + echo "Need server and directory as arguments." + false +fi +server=$1 +dir=$2 +path_package=/tmp/delete.tar + +eval `ssh-agent` +ssh-add +cd +ssh plom@"${server}" "cd \"${dir}\" && tar cf ${path_package} ." +scp plom@"${server}":"${path_package}" . +mkdir -p "${dir}" +cd "${dir}" +tar xf "${path_package}" +cd +rm "${path_package}" +ssh plom@"${server}" rm "${path_package}"