我正在尝试让LibreOffice (更确切地说,是soffice)在Ubuntu服务器(20.04.3)上作为服务运行,但我只是无法使它工作。这是我第一次尝试设置自定义服务,因此它配置错误的可能性很高。
基本上,我想让soffice在无头模式下运行,在套接字中监听。我使用的命令是:
/usr/bin/soffice --headless --accept='socket,host=127.0.0.1,port=8100;urp;' --nofirststartwizard从我所能看到的情况来看,这个命令似乎起作用了。当我手动运行它时,没有任何输出,它阻塞终端,据说是在等待传入的连接。
因此,为了将其作为服务运行,我在soffice.service上创建了以下/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在启用和启动它之后,我在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)我猜问题就在ExecStart指令上,但是尽管我读了这些文档--这对我来说很难理解,因为我只使用linux来保持我的was服务器运行--我只是不知道出了什么问题。任何帮助都将不胜感激。
发布于 2022-02-07 05:20:01
显然,是ExecStart上的双引号引起了麻烦。我将测试一切,并编辑这个答案,一旦我确定它是有效的。
https://stackoverflow.com/questions/71009842
复制相似问题