On Sat, Feb 23, 2013 at 8:13 PM, Mantas Mikulėnas <[email protected]> wrote: > On Sat, Feb 23, 2013 at 8:01 PM, lux-integ <[email protected]> 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 <[email protected]> _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
