On Sat, Jun 20, 2015 at 03:33:20PM +0200, nusenu wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
> 
> >>> imagine you have N services named:
> >>> 
> >>> service service1 service2 ...
> >>> 
> >>> Now you want to stop 'service' and you run: 'rcctl stop
> >>> service'
> >>> 
> >>> all (not just one) of them are gone?
> >>> 
> >>> 
> >>> rc.subr invokes pkill and does a "startswith" match but does
> >>> not require a perfect/complete match.
> >>> 
> >>> 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
So this cannot be used as a generic solution.

If you want to match the exact complete command line, adapt pexp accordingly 
and end it with '$'.

> 
> iQIcBAEBCgAGBQJVhWugAAoJEFv7XvVCELh0U6wP/0vOT73glYbmFllM2WlLLCqF
> 7PAovqHtwI+fqYeD7rovfHutOXkLvw4AYGEAeCpsP+og3WNY27Qh3BtVpWY/eNI2
> N7FlBSmMBmD/QJPArYkQdmj8C5NTgkHwjUoFfOaGsf/hHIIiqunT4ohkYi9+XbPG
> LW8i/aqL2MCpMhQJn6isMsVpdjLp0Vf7A1n0BuR03cwwzO/Ij4xkZFubmdj8KOSv
> FZy5SjNDPteTTOFPxrvR47Nuz6ztPAo1BWmHdr9E2acLyvervN5dcKuSHNMitZrH
> fMwSgo6hkcu/Uj36fybguMPasvfCwS6Q5rD7D0M6MjuQDFfBw6mOckbcr//65iK1
> n4/UDU9VyT041Rhjq0uXVIVNmbpHbKCSUFg1yBRpRwJSE7Lx7QDRF152y/v0Ble9
> qa28bkOfhSbGwbDwasg7sP7CsZrqI7ebyQNVq8jxDrR5B0wM4Wkpt7VcGTRRgvhj
> clAl0hhUNxlCI+TGRslaWs1O839m+gDS6Lf3eaoEMSrWdKrBitUsISzZykPyoSu0
> pNVQQtWFkII+CyP4E8Vh5HM8WQp01odEueOV8Vf8DUVMV14WTd9nAbILx2KEgNU5
> aRvXolxtGQfTW94UN59e9LJWRm0l7ikRoS7XKJ/ZQQd0IV91AySVrl6OFHybrk09
> gmimAMIHiQkuhFpu4TYW
> =MTr3
> -----END PGP SIGNATURE-----
> 

-- 
Antoine

Reply via email to