Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs: batch processing of org mode files via crontab

I'm new to org-mode and wrote a file with Babel in a few languages. I would like the file to each day, running the code in the org file, on a remote server - I don't think that's important.

I wanted to do it with cron. I was trying something like

crontab emacs -batch -l my_file.org

like image 901
user945543 Avatar asked Mar 12 '12 21:03

user945543


2 Answers

Section 14.12 of the Org manual will be a good entry point for batch execution. Its online version can be found at http://orgmode.org/manual/Batch-execution.html. It introduces an example using org-babel-tangle, so you might want to replace org-babel-tangle with your own function.

like image 92
tnoda Avatar answered Nov 15 '22 10:11

tnoda


I have this in crontab:

emacs -batch -l ~/.emacs -eval '(org-batch-agenda "w")' > ~/org/aux/agenda-export.txt

This uses a custom agenda I already have set up (C-c a w in orgmode) and exports to a text file. I then call that file via conky to display my agenda over my wallpaper.

Per the comments, you're going to want to do this via:

crontab -e

This opens up your crontab file to edit. Add the execution timeline (minute hour day-of-month month day-of-week) and the command you want to run (starting with emacs ...) and you should be set. See the crontab man page for more details if you're not familiar).

Basically, figure out how to execute the org command successfully from the command line and then add it (prefixed with the columns telling cron when to run) via crontab -e.

like image 20
Hendy Avatar answered Nov 15 '22 10:11

Hendy