我创建了一个静态 systemd 服务文件“irtrans.service”,如下所示:
[Unit]
Description=irtrans daemon
After=network-online.target
[Service]
Type=forking
#EnvironmentFile=/etc/conf.d/lircd.conf
#PIDFile=/run/lirc/lircd.pid
ExecStartPre=/bin/mkdir -p /var/run/lirc
ExecStartPost=/bin/ln -s /dev/lircd /var/run/lirc/lircd
ExecStart=/usr/local/irtrans/irserver64 -timestamp -logfile /var/log/irtrans.log -loglevel 4 -daemon 172.31.252.14
ExecStopPost=/bin/rm -f /dev/lircd
ExecStopPost=/bin/rm -fR /var/run/lirc
[Install]
#WantedBy=kodi.service
和一个 kodi.service 文件如下:
[Unit]
Description = kodi-standalone using xinit
After = remote-fs.target systemd-user-sessions.service
Wants = irtrans.service
[Service]
User = kodi
Group = kodi
PAMName = login
Type = simple
ExecStart = /usr/bin/xinit /usr/bin/dbus-launch /usr/bin/kodi-standalone -- :0 -nolisten tcp
Restart = on-abort
[Install]
WantedBy = multi-user.target
启动时,kodi 服务启动,但 irtrans 服务失败。我可以在系统启动后手动启动irtrans服务,但启动后无法自动启动。 irtrans 的 systemctl 状态显示:
● irtrans.service - irtrans daemon
Loaded: loaded (/etc/systemd/system/irtrans.service; static; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2016-12-24 17:44:52 EST; 1min 31s ago
Process: 767 ExecStart=/usr/local/irtrans/irserver64 -timestamp -logfile /var/log/irtrans.log -loglevel 4 -daemon 172.31.252.14 (c
Process: 755 ExecStartPre=/bin/mkdir -p /var/run/lirc (code=exited, status=0/SUCCESS)
Dec 24 17:44:47 pclivingroom.ocg.ca systemd[1]: Starting irtrans daemon...
Dec 24 17:44:52 pclivingroom.ocg.ca systemd[1]: irtrans.service: Control process exited, code=exited status=1
Dec 24 17:44:52 pclivingroom.ocg.ca systemd[1]: Failed to start irtrans daemon.
Dec 24 17:44:52 pclivingroom.ocg.ca systemd[1]: irtrans.service: Unit entered failed state.
Dec 24 17:44:52 pclivingroom.ocg.ca systemd[1]: irtrans.service: Failed with result 'exit-code'.
有人可以解释为什么会发生这种情况以及如何解决它吗?我认为这意味着 irtrans 可执行文件无法启动,但它仅取决于我列为依赖项的网络。
建议?