On Sat, Jun 20, 2015 at 09:44:14PM +0200, nusenu wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > >>>>> What do you think about this patch to require a perfect > >>>>> match > >>>>>>>>> when sending invoking pkill/pgrep? > >>>>> > >>>>> Won't work. Carefully read pgrep(1) again. > >>> > >>> After reading the man page again I even found something more > >>> fitting: > >>> > >>>>> -x Require an exact match of the process name, or > >>>>> argument list if -f is given. The default is to match any > >>>>> substring. > >>> > >>> Since it seems to do what I'm aiming for, could you give me an > >>> example for what won't work? > >>> > >>> thanks! > >>> > >>> my tests: > >>> > >>> # ps ax|grep tor 24508 ?? S 0:03.85 tor -f torrc2 19493 > >>> ?? S 0:00.79 tor -f torrc > >>> > >>> # pgrep -fx tor # no result expected > >>> > >>> # pgrep -fx 'tor -f torrc' # expected result: 19493 but NOT > >>> 24508 19493 > >>> > >>> # pgrep -fx 'tor -f torrc2' # expected result: 24508 24508 > > Some daemons will happend more stuffs to the command line than just > > $daemon $daemon_flags > > Then $pexp should include everything that a daemon can append via > rc.conf.local settings?
No. > > So this cannot be used as a generic solution. > > Wouldn't it make sense to use '-x' by defaut in rc.subr to be more > strict and less likely to unintentionally kill other daemons in general? No, for the reason I mentioned. > > If you want to match the exact complete command line, adapt pexp > > accordingly and end it with '$'. > > Can $pexp be set via /etc/rc.conf.local? No, you need to edit the rc script for that. -- Antoine

