From e0449cf17f4a1e9a096a6f7b9806f21834537ffa Mon Sep 17 00:00:00 2001 From: camlafit Date: Tue, 14 Mar 2017 09:56:30 +0100 Subject: [PATCH 1/2] Execute in background process It's better to split command call in two part. Set command to execute with binary path and execute after in background --- scripts/odt2pdf/odt2pdf.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/odt2pdf/odt2pdf.sh b/scripts/odt2pdf/odt2pdf.sh index b44ab3e6d78..1147ff3bbcc 100755 --- a/scripts/odt2pdf/odt2pdf.sh +++ b/scripts/odt2pdf/odt2pdf.sh @@ -17,13 +17,16 @@ then exit fi +soffice="/usr/bin/soffice" + if [ -f "$1.odt" ] then nbprocess=$(pgrep -c soffice) if [ $nbprocess -ne 1 ] # If there is some soffice process running then - soffice --invisible --accept="socket,host=127.0.0.1,port=8100;urp;" --nofirststartwizard --headless & + cmd="$soffice --invisible --accept=socket,host=127.0.0.1,port=8100;urp; --nofirststartwizard --headless" + $cmd & retcode=$? if [ $retcode -ne 0 ] then From 67189fa68399ff62b6691a218427b013123e9d51 Mon Sep 17 00:00:00 2001 From: "cam.lafit" Date: Tue, 14 Mar 2017 10:17:10 +0100 Subject: [PATCH 2/2] Provide a home directory to java/soffice By default www-data run as system user on /root directory, to prevent some error about right user we : * move first to /tmp directory * set /tmp as home www-data user If needed admin sys can update *$home_java* to a valide www-data directory --- scripts/odt2pdf/odt2pdf.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/odt2pdf/odt2pdf.sh b/scripts/odt2pdf/odt2pdf.sh index 1147ff3bbcc..75aa6cc15f0 100755 --- a/scripts/odt2pdf/odt2pdf.sh +++ b/scripts/odt2pdf/odt2pdf.sh @@ -18,15 +18,15 @@ then fi soffice="/usr/bin/soffice" - +home_java="/tmp" if [ -f "$1.odt" ] then nbprocess=$(pgrep -c soffice) if [ $nbprocess -ne 1 ] # If there is some soffice process running then - cmd="$soffice --invisible --accept=socket,host=127.0.0.1,port=8100;urp; --nofirststartwizard --headless" - $cmd & + cmd="$soffice --invisible --accept=socket,host=127.0.0.1,port=8100;urp; --nofirststartwizard --headless -env:UserInstallation=file:///$home_java/" + export HOME=$home_java && cd $home_java && $cmd& retcode=$? if [ $retcode -ne 0 ] then