-
Notifications
You must be signed in to change notification settings - Fork 30
FAQ
https://angelborroy.wordpress.com/2017/01/19/alfresco-installing-ocr-as-an-external-service/
Solution provided by jk-ots
If you are running into these troubles reg. dependencies between any "external" software called and Alfresco, and you are not able or willing to install from scratch, you can isolate the call from alfresco to the external package by using a script, but spawn a new user-session from within the script, which has the correct initialization for the external software.
So you can check and setup the external package independently from Alfresco and then just call it via script as if you would do from a normal command line.
You simply do that by building a script like this:
#!/bin/bash
/bin/su -l -c "/comand2execute -options $@"
This is in case you use root as user. Otherwise you have to specify the user you want to spawn the session for (after /bin/su -l) and if you are running alfresco not as root you have to ensure that the credentials are specified, encrypted or not necessary - as you like.
Don't forget $@ at the end because here all params are forwarded coming from the caller (i. e. further options, source and destination file).
I would recommend to specify all your options in this script and NOT in the alfresco-global.properties
of this add-on, because
- you only have one place where you specify them
- you can change the call to the external software without restarting alfresco :-)
Solution provided by Coaxial
#!/usr/bin/env bash
# set -o xtrace # Uncomment for debugging/troubleshooting
sudo /usr/bin/pdfsandwich "$@"
By quoting your variable, you avoid word splitting. For example, if you passed several options as in -verbose -lang eng+fra
via ocr.extra.commands
, pdfsandwich would only run with -verbose
and without -lang
or anything after if $@ wasn't quoted.
Also, sudo is more sane than su because it sanitizes arguments.
Setting the xtrace
option gives a more verbose output in the logs when the command fail. It's quite helpful when troubleshooting.