[prev in list] [next in list] [prev in thread] [next in thread] 

List:       systemd-devel
Subject:    [systemd-devel] a little help with $MAINPID please
From:       grawity () gmail ! com (=?UTF-8?Q?Mantas_Mikul=C4=97nas?=)
Date:       2013-02-23 18:15:28
Message-ID: CAPWNY8V1=4agDqjRXh-9ghPX7CVKxFNU0qvK4beQXCoi2hKfow () mail ! gmail ! com
[Download RAW message or body]

On Sat, Feb 23, 2013 at 8:13 PM, Mantas Mikul?nas <grawity at gmail.com> wrote:
> On Sat, Feb 23, 2013 at 8:01 PM, lux-integ <lux-integ at btconnect.com> wrote:
>> b) what are the advantages or disadvantaes of the following line
>> ExecStop=/bin/kill -15 $(/bin/pidof mysqld)
>> over
>> ExecStop=/bin/kill -15 $MAINPID
>
> The former will simply not work, as Exec lines are not run through a
> shell and $() is not interpreted in them. Even if it worked, it would
> be unreliable as there can be more than one mysqld process. (For
> example, on a desktop system, one copy of mysqld can be running as a
> system service, and a second copy ? in the user's login session, as
> KDE uses MySQL as a storage backend. In this case, you would simply
> kill the *wrong process*.)
>
> The latter works, but is redundant, since sending SIGTERM is already
> what systemd does by default if ExecStop is not set. (You can change
> the signal by setting KillSignal.)

In addition, systemd kills *all* processes in the cgroup by default,
so you can be sure that you won't have leftover "helper" processes
left (which various services often use). Plain /bin/kill won't
guarantee that.

-- 
Mantas Mikul?nas <grawity at gmail.com>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic