[systemd-devel] DBUS API to restart unit by sending sigkill/sighup

Lennart Poettering lennart at poettering.net
Mon Sep 10 18:31:28 UTC 2018


On Mo, 10.09.18 12:12, prashantkumar dhotre (prashantkumardhotre at gmail.com) wrote:

> Hi,
> Is there is dbus API for systemd to restart unit by sending sigkill /sighup
> ?
> https://www.freedesktop.org/wiki/Software/systemd/dbus/
> RestartUnit(in  s name, in  s mode, out o job);

RestartUnit() will stop a unit, and then start it again. Stopping the
unit takes place with the command ExecStop= or (if not specified or
processes remain after ExecStop=) with SIGTERM, followed by a timeout
and SIGKILL.

> My requirement is to have a way to restart unit by sending sigkill or
> sighup (user can specify ) also along with sigterm.

As Mantas mentioned SIGHUP is usually used for asynchronously
reloading service configuration, not for terminating them. That said,
shells tend to ignore SIGTERM and react to SIGHUP for shutdown
instead, which is why systemd exposes SendSIGHUP= to cover this case.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list