[systemd-devel] a little help with $MAINPID please

Reindl Harald h.reindl at thelounge.net
Sat Feb 23 09:58:06 PST 2013



Am 23.02.2013 19:01, schrieb lux-integ:
> Greetings
> 
> I am an absolute beginner with systemd.  I came across the gentoo   systemd 
> script 
> ( http://en.gentoo-wiki.com/wiki/Systemd )
> for mysql-daemon.  It has these lines:-
> 
> ExecStart=/usr/sbin/mysqld --pid-file=/var/run/mysqld/mysqld.pid
> ExecStop=/bin/kill -15 $MAINPID
> PIDFile=/var/run/mysqld/mysqld.pid
> 
> I am curious and  puzzled about two things.
> a) What  is $MAINPID  which I have seen in so many systemd scripts
> i.e. where is is set? or how is it determined?
> b) what are the advantages or disadvantaes of the following line 
> ExecStop=/bin/kill -15 $(/bin/pidof mysqld)
> over
> ExecStop=/bin/kill -15 $MAINPID

systemd simply knows the PID because it has started
the service and crontrols it - why would you want to
use external commands if the init-system has all needed
informations because it is it's job to have them

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20130223/36929022/attachment-0001.pgp>


More information about the systemd-devel mailing list