How to start libreoffice in daemon mode?

I’m trying to create a libreoffice daemon on my machine (so that files are opened faster without having to re-launch the entire office every time).

I tried:

soffice --nologo --nodefault --norestore

And then I open a file (in a separate terminal):

libreoffice <file>

The file opens much faster indeed. However, after I close the window soffice also exits. I tried adding --accept option, but that didn’t change the behavior.

Is there a way to start libreoffice daemon and keep it running even if all windows were closed?

Hi Rogach

I was also facing the issue of libreoffice taking too much time to launch and open the files.Later i saw your post and used this method of soffice running in the background and launching the application.This worked for me.Thanks for that solution.

Now coming to the issue of running the soffice as daemon i followed the some method and it worked for me, you can also try once.
It works in simple way, when ever a user log’s in the .desktop file present in the .config/autostart folder will run and that desktop will run the .sh file in that .sh file we have the soffice binary command which will run at the backend as a daemon.

Add the .desktop file in the autostart folder.

Autostart .desktop entry file for New user’s

mkdir -p .config/autostart
cat >.config/autostart/gnome-setup.desktop <<EOL
[Desktop Entry]
Type=Application
Exec=/usr/local/bin/gnome-login-setup/setup.sh
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=GNOME Session Setup
Comment=Sets up dock, window buttons, and other GNOME tweaks
EOL

Inside this folder we have the commands to run the soffice in the backend and even when the applicaiton is closed this will start again and keep running in the backend.
The if condition will check whether the soffice binary is present or not, if the binary is present then only the soffice will run in the background else it will not this will make sure that no conflicts occur when the soffice is not present.

vi /usr/local/bin/gnome-login-setup/setup.sh

while :; do
if [ -e “/usr/lib/libreoffice/program/soffice” ]; then
/usr/lib/libreoffice/program/soffice --nologo --nodefault --norestore
fi
done