mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
cpuplugd: Improve systemctl start error handling
Currently "systemctl start cpuplugd" does not report any errors in
case the startup fails.
Example:
# mv /etc/cpuplugd.conf /etc/cpuplugd.conf.xxx
# systemctl start cpuplugd
The reason is that for type=simple systemd forks/execs cpuplugd and if
that is successful immediately returns. There is no way to find out
if the initial startup fails.
Fix this by using type=fork and running cpuplugd in the background. In
this case systemd waits until the initial process returns.
In addition use PIDFile and ensure that the pid file is already available
when the initial cpuplugd process returns. To achieve this, replace the
daemon() function by our own implementation that introduces startup
synchronization via pipe. Without that systemd would print the following
warning:
systemd[1]: cpuplugd.service: PID file /var/run/cpuplugd.pid not readable
(yet?) after start: No such file or directory
With this patch, an early startup error like in the example above, is now
reported correctly in "systemctl start":
# systemctl start cpuplugd
Job for cpuplugd.service failed because the control process exited...
See "systemctl status cpuplugd.service" and "journalctl -xe" for ...
# journalctl -ex | grep cpuplugd
Nov 16 15:52:27 ... cpuplugd[5096]: Opening configuration file failed:
No such file or directory
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Acked-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
This commit is contained in:
@@ -13,10 +13,11 @@ Documentation=man:cpuplugd(8) man:cpuplugd.conf(5)
|
||||
After=remote-fs.target
|
||||
|
||||
[Service]
|
||||
ExecStart=@usrsbin_path@/cpuplugd -f -c @sysconf_path@/cpuplugd.conf
|
||||
ExecStart=@usrsbin_path@/cpuplugd -c @sysconf_path@/cpuplugd.conf
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
KillMode=process
|
||||
Type=simple
|
||||
Type=forking
|
||||
PIDFile=/var/run/cpuplugd.pid
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
Reference in New Issue
Block a user