blob: d54683c554cfe8448be524ec6b4b8c63065b7421 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#!/bin/bash
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] || [ "$1" == "--" ] || [ "$2" == "--" ] || [ "$3" == "--" ]; then
echo "$0 <src-host> <src-path> <dest-path> [ -- <additional syncoid arguments .. > ]"
exit 1
fi
src_host=$1
src_path=$2
dest_path=$3
shift 3
if [ -n "$1" ]; then
if [ "$1" != "--" ]; then
echo "additional arguments must be separated using '--'"
exit 1
fi
shift
fi
if [ -n "$RUNTIME_DIRECTORY" ]; then
if [ ! -e "$RUNTIME_DIRECTORY/start" ]; then
date +"%s" > "$RUNTIME_DIRECTORY/start"
fi
fi
/usr/sbin/syncoid --sshoption "UserKnownHostsFile=/var/lib/syncoid/ssh.knownhosts" --sshoption "HashKnownHosts=no" --sshkey "/var/lib/syncoid/id_ssh_ed25519" --no-sync-snap --compress zstd-fast "$@" "$src_host:$src_path" "$dest_path"
ret=$?
if [ -n "$RUNTIME_DIRECTORY" ]; then
cat <<EOF >> "$RUNTIME_DIRECTORY/metrics"
syncoid_pull_exit_code{backup_server="{{ inventory_hostname }}",source="$src_path",destination="$dest_path"} $ret
EOF
echo $ret >> "$RUNTIME_DIRECTORY/exit_codes"
fi
exit $ret
|