[systemd-devel] forking PIDFile question
Andrei Borzenkov
arvidjaar at gmail.com
Tue Feb 20 04:30:06 UTC 2018
20.02.2018 00:29, steve at goodey.org пишет:
> Hello,
>
> Sorry if this question is a bit basic for a devel list, I tried asking it in a ubuntu forum but
> didn't get any views, let alone replies.
>
> I have a PC running Mythbuntu which has an LCD which I had a bit of a struggle getting
> going under systemd. However using Type=forking it is now working fine. However
> reading the man page for systemd.service is says that it is recommended to use PIDFile. I
> have tried adding PIDFile=/run/LCDd.pid but this causes an error message:-
>
> LCDd.service - LCDd
> Loaded: loaded (/etc/systemd/system/LCDd.service; enabled; vendor preset: enabled)
> Active: activating (start) since Tue 2018-02-13 09:49:03 GMT; 1min 8s ago
> Process: 2485 ExecStart=/usr/sbin/LCDd -c /home/steve/lcd/LCDd.conf (code=exited,
> status=0/SUCCESS)
> CGroup: /system.slice/LCDd.service
> └─2487 /usr/sbin/LCDd -c /home/steve/lcd/LCDd.conf
>
> Feb 13 09:49:03 mythbuntu systemd[1]: Starting LCDd...
> Feb 13 09:49:03 mythbuntu systemd[1]: LCDd.service: PID file /run/LCDd.pid not readable
> (yet?) after start: No such file or directory
> steve at mythbuntu:~$
>
> Removing the line PIDFile=/run/LCDd.pid in LCDd.service and all is good.
> I have tried creating LCDd.pid in /run with root:root but get the same. How is the pid file
> generated?
It is expected to be written by your service binary. Ideally it should
do it only after it has completed initialization and is ready to provide
services.
> Am I right in thinking that LCDd is so old that it hasn't been written with systemd
> in mind so does not support PIDFile?
>
PID files predate systemd.
More information about the systemd-devel
mailing list