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