diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2023-04-12 11:49:55 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2023-04-12 11:49:55 +0800 |
commit | 73e2aa4cee08900882d77cb94a74c338aa9740f2 (patch) | |
tree | bae3519d18ea20d31d8262629c89f886d9a4866e /bin/unix/rsync_retry.sh | |
parent | 4a07004b6ee653209bae7a40257885759c22ea27 (diff) |
Update
Diffstat (limited to 'bin/unix/rsync_retry.sh')
-rwxr-xr-x | bin/unix/rsync_retry.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/bin/unix/rsync_retry.sh b/bin/unix/rsync_retry.sh new file mode 100755 index 0000000..be70c03 --- /dev/null +++ b/bin/unix/rsync_retry.sh | |||
@@ -0,0 +1,14 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | REMOTE=${REMOTE:-vps} | ||
4 | SRC="$1" | ||
5 | DEST="$2" | ||
6 | DEST="${DEST:-$1}" | ||
7 | |||
8 | # If fail to sync file, then | ||
9 | if rsync -au "${SRC}" ${REMOTE}:"${DEST}"; then | ||
10 | rm "${SRC}".retry 2>/dev/null | ||
11 | true | ||
12 | else | ||
13 | echo ${DEST} >${SRC}.retry | ||
14 | fi | ||