X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=update_mobile_org;h=6eb7c6cefe6e90d24145e1605013ae8a48570d2e;hb=3d5241a316e3ff729b19b878b0841558120f75e9;hp=8c249011b7610da464d0c3445c22bf56df3a77cc;hpb=48cb4ff960ba4b49ce03559cbd55de13d3fa7e33;p=bin.git diff --git a/update_mobile_org b/update_mobile_org index 8c24901..6eb7c6c 100755 --- a/update_mobile_org +++ b/update_mobile_org @@ -1,6 +1,32 @@ #!/bin/bash +GIT_HOST="linnode" + +HOSTNAME=$(hostname) TMPDIR=~/tmp export TMPDIR -. ~/.ssh/ssh_agent_info_$(hostname) -emacs --batch -l ~/.emacs -f 'org-mobile-push' -f 'org-mobile-pull' +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; +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';