From 55d0d7886d89915f36b961e03213afd22865e835 Mon Sep 17 00:00:00 2001 From: Pineal Servo Date: Tue, 22 Jul 2014 16:51:12 -0600 Subject: [PATCH] An un-summarized change. --- tools/inbox_watcher.page | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tools/inbox_watcher.page diff --git a/tools/inbox_watcher.page b/tools/inbox_watcher.page new file mode 100644 index 0000000..a957e69 --- /dev/null +++ b/tools/inbox_watcher.page @@ -0,0 +1,16 @@ +A tool for running pandoc when a file is saved in an inbox directory: + +~~~ { .shell } +#!/bin/sh +INBOX=/pub/markdown/inbox +OUTBOX=../outbox/ +PANDOC=/home/levi/bin/pandoc_wrapper +cd $INBOX +inotifywait -mqre close_write --format '%f' ${INBOX} | while read FILE +do + echo "Detected write on file: ${FILE}" + ${PANDOC} ${FILE} ${OUTBOX} +done +~~~ + +The `pandoc_wrapper` is a script that calls pandoc with the appropriate parameters for the document formatting I want to do. It takes a source file and a destination directory as parameters; it automatically creates the destination name based on the source file name and the destination directory. \ No newline at end of file