aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xbin/task/context3
-rwxr-xr-xbin/unix/rsync_retry.sh14
2 files changed, 16 insertions, 1 deletions
diff --git a/bin/task/context b/bin/task/context
index c8e3f7a..fd10baf 100755
--- a/bin/task/context
+++ b/bin/task/context
@@ -7,10 +7,11 @@
7# 7#
8# TODO support minus time 8# TODO support minus time
9 9
10LOG_FILE=~/log/.context && touch $LOG_FILE 10LOG_FILE=~/.context && touch $LOG_FILE
11PLAN_FILE=~/log/plan.context.md 11PLAN_FILE=~/log/plan.context.md
12PROC=$$ 12PROC=$$
13trap 'exit 1' SIGUSR1 13trap 'exit 1' SIGUSR1
14trap 'rsync_retry $0' EXIT
14 15
15context="$(cat ~/.task/context)" 16context="$(cat ~/.task/context)"
16[[ "$*" =~ '-s' ]] && SET=true && shift 17[[ "$*" =~ '-s' ]] && SET=true && shift
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
3REMOTE=${REMOTE:-vps}
4SRC="$1"
5DEST="$2"
6DEST="${DEST:-$1}"
7
8# If fail to sync file, then
9if rsync -au "${SRC}" ${REMOTE}:"${DEST}"; then
10 rm "${SRC}".retry 2>/dev/null
11 true
12else
13 echo ${DEST} >${SRC}.retry
14fi