home · contact · privacy
Fix.
[config] / bullseye / setup_scripts / mirror_dir.sh
1 #!/bin/sh
2 # Mirror directory tree from remote to local server, keeping the path.
3 set -e
4
5 if [ $# -lt 2 ]; then
6     echo "Need server and directory as arguments."
7     false
8 fi
9 server=$1
10 dir=$2
11 path_package=/tmp/delete.tar
12
13 eval `ssh-agent`
14 ssh-add
15 cd
16 ssh plom@"${server}" "cd \"${dir}\" && tar cf ${path_package} ."
17 scp plom@"${server}":"${path_package}" "${path_package}"
18 mkdir -p "${dir}"
19 cd "${dir}"
20 tar xf "${path_package}"
21 cd
22 rm "${path_package}"
23 ssh plom@"${server}" rm "${path_package}"