X-Git-Url: https://git.donarmstrong.com/?p=bin.git;a=blobdiff_plain;f=update_mobile_org;h=b124ffd9ea8b1de85fe248864710e6ea4cec5fd8;hp=27f18e24873c1dd846cc33c680645d16d106d799;hb=56c8d8b286ae38e170ce915472f9aa86fabf9fee;hpb=d85b208c9448fa35a79056e0c0484df7dd3c6985 diff --git a/update_mobile_org b/update_mobile_org index 27f18e2..b124ffd 100755 --- a/update_mobile_org +++ b/update_mobile_org @@ -1,10 +1,32 @@ #!/bin/bash +GIT_HOST="linnode" + +HOSTNAME=$(hostname) TMPDIR=~/tmp export TMPDIR -. ~/.ssh/ssh_agent_info_$(hostname) +if [ -e ~/.ssh/ssh_agent_info_${HOSTNAME} ]; then + . ~/.ssh/ssh_agent_info_${HOSTNAME} +fi; LOCKOPTS=-q +LOCKFILE=$TMPDIR/update_mobile_org if [ -n "$PS1" ]; then LOCKOPTS=-f; fi; -with-lock-ex $LOCKOPTS $TMPDIR/update_mobile_org emacs --batch -l ~/.emacs -f 'org-mobile-push' -f 'org-mobile-pull' +LOCKIT="with-lock-ex $LOCKOPTS $LOCKFILE" +TIMEOUT="timeout -k1m 1m" +${LOCKIT} ${TIMEOUT} mr -d ~/org-mode up; +if [ "$HOSTNAME" = "$GIT_HOST" ]; then + ${LOCKIT} ${TIMEOUT} mr -d ~/projects/org-notes up; +else + ${LOCKIT} ${TIMEOUT} emacsclient -n -e '(org-save-all-org-buffers)' >/dev/null 2>&1; +fi; +yes|${LOCKIT} timeout -k1m 5m emacs --batch -l ~/.emacs \ + --eval '(org-mobile-push)' --eval '(org-mobile-pull)' --eval '(org-save-all-org-buffers)'; + +if [ "$HOSTNAME" = "$GIT_HOST" ]; then + ${LOCKIT} ${TIMEOUT} \ + mr -d ~/projects/org-notes commit -m'org mobile automated commit and push'; +fi; +${LOCKIT} ${TIMEOUT} \ + mr -d ~/org-mode commit -m'org mobile automated commit and push';