Due to emacs interlocking files I want to run org-mobile command via cron but using the emacsclient:
emacsclient -nw --eval "(org-mobile-pull)" --eval "(org-mobile-push)"
but if there is no emacs server running I want the command to run using emacs batch mode:
emacs --batch --eval "(org-mobile-pull)" --eval "(org-mobile-push)"
I’m not sure how to accomplish this so curious if anyone has any ideas.
I’m curious what you’re ultimately trying to accomplish? Why not just always
start a new Emacs process? The additional overhead would be a small fraction of a second
On my 2 year old MBP:
Going down your current path, you can check the exit code from
emacsclientto decide if you should run in batch
EDIT: I see you want to script an answer to the lock stealing question. Check
out my answer to this question for using
ask-user-about-lockto solve this.EDIT: So the idea is to redefine
ask-user-about-lockto return t. See docs:script example (remember to chmod)