I have a small script that runs the following command to export my org-mode agendas automatically:
emacs -batch -l ~/.emacs.d/init.el -eval '(org-batch-store-agenda-views)'
Occasionally, a required agenda file is missing or unavailable, which causes emacs to pause at the command prompt with something like the following:
Non-existent agenda file ~/gtd/missing.org. [R]emove from list or [A]bort?
Emacs will then hang until I kill it using Ctrl+C.
Is there a way to get emacs to automatically abort in batch mode if user input is not available? Or is it possible to set a timeout on the running of emacs in batch mode, so that it automatically exits after a certain period of time.
(I tried using the timeout
shell command — e.g. timeout 10s emacs -batch ...
— but that doesn't work either.)