home · contact · privacy
Fix variable name.
[config] / bookworm / setup_scripts / mirror_dir.sh
1 #!/bin/sh
2 # Mirror directory tree from remote to local server, keeping the path.
3 set -e
4 . ./misc.sh
5
6 expect_n_args 2 "(server, directory)" "$@"
7 server=$1
8 dir=$2
9 path_package=/tmp/delete.tar
10
11 eval `ssh-agent`
12 ssh-add
13 cd
14 ssh plom@"${server}" "cd \"${dir}\" && tar cf ${path_package} ."
15 scp plom@"${server}":"${path_package}" "${path_package}"
16 mkdir -p "${dir}"
17 cd "${dir}"
18 tar xf "${path_package}"
19 cd
20 rm "${path_package}"
21 ssh plom@"${server}" rm "${path_package}"