From 07a7397b1bcca6087ef3fbee5811555c950f1c84 Mon Sep 17 00:00:00 2001 From: Rida Ayed Date: Mon, 1 Nov 2021 17:53:50 +0100 Subject: [PATCH 1/3] link directly to script in repo --- docs/advanced_usage.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/advanced_usage.rst b/docs/advanced_usage.rst index b7d46e063..0a2af330e 100644 --- a/docs/advanced_usage.rst +++ b/docs/advanced_usage.rst @@ -104,7 +104,7 @@ you execute scripts of your own choosing just before or after a document is consumed using a couple simple hooks. Just write a script, put it somewhere that Paperless can read & execute, and -then put the path to that script in ``paperless.conf`` with the variable name +then put the path to that script in ``paperless.conf`` or ``docker-compose.env`` with the variable name of either ``PAPERLESS_PRE_CONSUME_SCRIPT`` or ``PAPERLESS_POST_CONSUME_SCRIPT``. From d85e5878bb7b6fb22a42596d69af91e44c37255d Mon Sep 17 00:00:00 2001 From: Rida Ayed Date: Mon, 1 Nov 2021 17:56:18 +0100 Subject: [PATCH 2/3] add link --- docs/advanced_usage.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/advanced_usage.rst b/docs/advanced_usage.rst index 0a2af330e..3fed923c8 100644 --- a/docs/advanced_usage.rst +++ b/docs/advanced_usage.rst @@ -168,11 +168,11 @@ into paperless. It receives the following arguments: * Tags The script can be in any language you like, but for a simple shell script -example, you can take a look at ``post-consumption-example.sh`` in the -``scripts`` directory in this project. +example, you can take a look at `post-consumption-example.sh`_ in this project. The post consumption script cannot cancel the consumption process. +.. _post-consumption-example.sh: https://github.com/jonaswinkler/paperless-ng/blob/master/scripts/post-consumption-example.sh .. _advanced-file_name_handling: File name handling From 87b2c76fa1063cc68dde93cb25fca12d0da0c887 Mon Sep 17 00:00:00 2001 From: Rida Ayed Date: Mon, 1 Nov 2021 17:56:58 +0100 Subject: [PATCH 3/3] add docker subsection --- docs/advanced_usage.rst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/advanced_usage.rst b/docs/advanced_usage.rst index 3fed923c8..d834a45cf 100644 --- a/docs/advanced_usage.rst +++ b/docs/advanced_usage.rst @@ -172,7 +172,35 @@ example, you can take a look at `post-consumption-example.sh`_ in this project. The post consumption script cannot cancel the consumption process. +Docker +------ +Assumed you have ``/home/foo/paperless-ng/scripts/post-consumption-example.sh``. + +You can pass that script into the consumer container via a host mount in your ``docker-compose.yml``. + +.. code:: bash + ... + consumer: + ... + volumes: + ... + - /home/paperless-ng/scripts:/path/in/container/scripts/ + ... + +Example (docker-compose.yml): ``- /home/foo/paperless-ng/scripts:/usr/src/paperless/scripts`` + +which in turn requires the variable ``PAPERLESS_POST_CONSUME_SCRIPT`` in ``docker-compose.env`` to point to ``/path/in/container/scripts/post-consumption-example.sh``. + +Example (docker-compose.env): ``PAPERLESS_POST_CONSUME_SCRIPT=/usr/src/paperless/scripts/post-consumption-example.sh`` + +Troubleshooting: + +- Monitor the docker-compose log ``cd ~/paperless-ng; docker-compose logs -f`` +- Check your script's permission e.g. in case of permission error ``sudo chmod 755 post-consumption-example.sh`` +- Pipe your scripts's output to a log file e.g. ``echo "${DOCUMENT_ID}" | tee --append /usr/src/paperless/scripts/post-consumption-example.log`` + .. _post-consumption-example.sh: https://github.com/jonaswinkler/paperless-ng/blob/master/scripts/post-consumption-example.sh + .. _advanced-file_name_handling: File name handling