I have a systemd
startup script for a forking service (let's call it foo
) based on YAJSW (Yet Another Java Service Wrapper). The relevant part of the .service
file looks like this:
ExecStart=/opt/foo/startup.sh
ExecStop=/opt/foo/shutdown.sh
Restart=always
Type=forking
PIDFile=/opt/foo/wrapper.pid
The startup.sh
script is responsible for starting the YAJSW wrapper. The YAJSW configuration file is set so that its PID is written to a file during startup:
wrapper.pidfile = /opt/foo/wrapper.pid
This way if the wrapper process dies (for any reason), systemd should bring it up, which is the desired behaviour. I have verified that this configuration works correctly, yet a strange line shows in journalctl:
foo.service: PID file /opt/foo/wrapper.pid not readable (yet?) after start: No such file or directory
Strangely, the systemctl status foo shows the main PID correctly:
foo.service
...
Main PID: 12313 (java)
Am I doing something wrong or is this a bug in one of the software components? I am running Ubuntu 16.04.3 LTS, kernel version 4.4.0, systemd version 229.4. Any help will be appreciated.