Script from SysV to SystemD
by Atikamekw from LinuxQuestions.org on (#4Z7VE)
Hi everyone,
I have some problem figuring this out so I'm asking for help. I had an init.d script that was sstarting a LibreOffice server and a Xvfd virtual screen and now that Red Hat changed the init.d script to systemd script, I can't make it to work correctly. I can make it work with only the LibreOffice server but whenever I tried to add the Xvfb (mandatory for LibreOfficeserver to run correctly) my script fails.
I use this script :
---------------------------------------------------------------
[Unit]
Description=Headless LibreOffice server script
Documentation=https://fr.libreoffice.org/
DefaultDependencies=no
[Service]
ExecStartPre=/usr/bin/Xvfb :1 -screen 0 1024x768x24 & > /dev/null 2>&1
ExecStart=/usr/lib64/libreoffice/program/soffice --headless --nolockcheck --norestore --nodefault '--accept=socket,host=localhost,port=8101,tcpNoDelay=1;urp;' --nofirststartwizard --nologo
Type=oneshot
TimeoutStopSec=5
PIDFile=/var/run/libreoffice-server.pid
[Install]
WantedBy=multi-user.target
---------------------------------------------------------------
If I comment the Xvfb line (ExecStartPre) and change the type to simple, it's working and launching the LibreOffice server but it can't be reach as it needs an XServer to run correcctly and be reachable from the network for my users to use it in there LibreOffice apps.
Any help would be really appreciated.
Thank you !!
Rick


I have some problem figuring this out so I'm asking for help. I had an init.d script that was sstarting a LibreOffice server and a Xvfd virtual screen and now that Red Hat changed the init.d script to systemd script, I can't make it to work correctly. I can make it work with only the LibreOffice server but whenever I tried to add the Xvfb (mandatory for LibreOfficeserver to run correctly) my script fails.
I use this script :
---------------------------------------------------------------
[Unit]
Description=Headless LibreOffice server script
Documentation=https://fr.libreoffice.org/
DefaultDependencies=no
[Service]
ExecStartPre=/usr/bin/Xvfb :1 -screen 0 1024x768x24 & > /dev/null 2>&1
ExecStart=/usr/lib64/libreoffice/program/soffice --headless --nolockcheck --norestore --nodefault '--accept=socket,host=localhost,port=8101,tcpNoDelay=1;urp;' --nofirststartwizard --nologo
Type=oneshot
TimeoutStopSec=5
PIDFile=/var/run/libreoffice-server.pid
[Install]
WantedBy=multi-user.target
---------------------------------------------------------------
If I comment the Xvfb line (ExecStartPre) and change the type to simple, it's working and launching the LibreOffice server but it can't be reach as it needs an XServer to run correcctly and be reachable from the network for my users to use it in there LibreOffice apps.
Any help would be really appreciated.
Thank you !!
Rick