Set pyuno socket as default launch option

Hi,

I’ve written a pyuno script that closes the documents appropriately without leaving a lock file when you kill LibreOffice (as descriped here: Close Libreoffice gracefuly from command line)

For testing purposes I start LibreOffice like this:

soffice "--accept=socket,host=localhost,port=2002;urp;"

But I don’t want to start libreoffice manually everytime. Is there any configuration to enable this socket by default no matter how I start libreoffice?

Thank you in advance

You can create a macro that’s triggered in ‘Application start’ event for that purpose.

If you SO used systemd, you can used it

Create file: /etc/systemd/system/libreoffice.service

[Unit]
Description=LibreOffice service
After=syslog.target

[Service]
ExecStart=/usr/bin/soffice --headless --invisible --accept='socket,host=localhost,port=8100;urp;StarOffice.ComponentContext'
Restart=always
KillSignal=SIGQUIT
Type=simple
StandardError=syslog
NotifyAccess=all
User=YOUR_USER
LimitNOFILE=10240
LimitNPROC=10240

[Install]
WantedBy=multi-user.target

Replace YOUR_USER for your correct value, then.

sudo systemctl enable libreoffice
sudo systemctl start libreoffice