I'm trying to get LibreOffice (more specifically, soffice) to run as a service on an Ubuntu server (20.04.3), but I've just not been able to make it work. It's the first time I'm trying to set up a custom service, so the likelihood that it's just configured wrong is very high.
Basically, I want to keep soffice running in headless mode, listening in a socket. The command I use for it is:
/usr/bin/soffice --headless --accept='socket,host=127.0.0.1,port=8100;urp;' --nofirststartwizard
From all I can see, this command seems to be working. No output whatsoever when I run it manually, and it blocks the terminal, supposedly waiting for incoming connections.
So, to run it as a service, I created the following soffice.service file on /etc/systemd/system:
[Unit]
Description=LibreOffice service
After=syslog.target
[Service]
ExecStart=soffice "--headless --accept='socket,host=127.0.0.1,port=8100;urp;' --nofirststartwizard"
Restart=always
KillSignal=SIGQUIT
Type=simple
StandardError=syslog
User=www-data
[Install]
WantedBy=multi-user.target
After enabling and starting it, I get the following on systemctl status soffice:
● soffice.service - LibreOffice service
Loaded: loaded (/etc/systemd/system/soffice.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2022-02-06 17:18:40 WET; 4s ago
Process: 24786 ExecStart=/usr/bin/soffice --headless --accept='socket,host=127.0.0.1,port=8100;urp;' --nofirststartwizard (code=exited, status=1/FAILURE)
Main PID: 24786 (code=exited, status=1/FAILURE)
I'm guessing the issue is on the ExecStart directive, but despite reading the documentation – which is hard to follow for me, since I only use linux to keep my webserver running – I just couldn't figure out what was wrong. Any help would be much appreciated.
Apparently, it was the double quotes on the ExecStart that were causing trouble. I'll test everything and edit this answer once I'm sure it's working.