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