mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	Merge branch 'RidaAyed-doc-docker-post-consumption' into dev
This commit is contained in:
		@@ -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``.
 | 
			
		||||
 | 
			
		||||
@@ -167,12 +167,40 @@ into paperless. It receives the following arguments:
 | 
			
		||||
* Correspondent
 | 
			
		||||
* Tags
 | 
			
		||||
 | 
			
		||||
The script can be written in any language, but for a simple shell script
 | 
			
		||||
example, you can take a look at ``post-consumption-example.sh`` in the
 | 
			
		||||
``scripts`` directory in this project.
 | 
			
		||||
The script can be in any language, but for a simple shell script
 | 
			
		||||
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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user