]> git.donarmstrong.com Git - bin.git/blob - update_mobile_org
switch hosts for update_mobile_org
[bin.git] / update_mobile_org
1 #!/bin/bash
2
3 HOSTNAME=$(hostname)
4 TMPDIR=~/tmp
5 export TMPDIR
6 . ~/.ssh/ssh_agent_info_${HOSTNAME}
7 LOCKOPTS=-q
8 LOCKFILE=$TMPDIR/update_mobile_org
9 if [ -n "$PS1" ]; then
10     LOCKOPTS=-f;
11 fi;
12 LOCKIT="with-lock-ex $LOCKOPTS $LOCKFILE"
13 TIMEOUT="timeout -k1m 1m"
14 ${LOCKIT} ${TIMEOUT} mr -d ~/org-mode up;
15 if [ "$HOSTNAME" = "linnode" ]; then
16     ${LOCKIT} ${TIMEOUT} mr -d ~/projects/org-notes up;
17 else
18     ${LOCKIT} ${TIMEOUT} emacsclient -n -e '(org-save-all-org-buffers)' >/dev/null 2>&1;
19 fi;
20 yes|${LOCKIT} timeout -k1m 5m emacs --batch -l ~/.emacs \
21                  --eval '(org-mobile-push)' --eval '(org-mobile-pull)' --eval '(org-save-all-org-buffers)';
22
23 if [ "$HOSTNAME" = "rzlab" ]; then
24     ${LOCKIT} ${TIMEOUT} \
25                  mr -d ~/projects/org-notes commit -m'org mobile automated commit and push';
26 fi;
27 ${LOCKIT} ${TIMEOUT} \
28           mr -d ~/org-mode commit -m'org mobile automated commit and push';