[GRLUG] problem with pkill/killall

Greg Folkert greg at gregfolkert.net
Wed Sep 4 20:15:44 EDT 2013


On Wed, 2013-09-04 at 19:12 -0400, Eric Beversluis wrote:
> My system has a problem in that its spawning multiple versions of a
> command and never ending the earlier versions. Why it's doing so is the
> next problem. But first I have to figure out how to kill them.
> 
> As nearly as I can tell from the web and the man pages, I should be able
> to do that with 'pkill' or with 'killall', using part of the name.
> 
> The processes are:
> 
> root     27514 27508  0 18:20 ?        00:00:00 /bin/bash -c php
> -f /var/www/virtual/vtiger.cyberacc.com/modules/CalendarSync/syncCalendarFromGA.php > /home/mundane/etc_cron_rept2.txt 2>&1
> root     27517 27507  0 18:20 ?        00:00:00 /bin/bash -c php
> -f /var/www/virtual/vtiger.cyberacc.com/modules/CalendarSync/syncCalendarFromVT.php > /home/mundane/etc_cron_rept2.txt 2>&1
> 
> So it seems I should be able to do:
> 
> pkill  syncCalendarFrom
> 
> or killall syncCalendarFrom
> 
> and thus get rid of all of them. But neither seems to work.
> 
> Some of my efforts:
> [root at server ~]# pkill syncCalendarFrom
> [root at server ~]# pkill "-c php
> -f /var/www/virtual/vtiger.server.com/modules/CalendarSync/syncCalendarFromGA.php > /home/mundane/etc_cron_rept2.txt 2>&1"
> pkill: invalid option -- 'c'
> Usage: pkill [-SIGNAL] [-fvx] [-n|-o] [-P PPIDLIST] [-g PGRPLIST] [-s
> SIDLIST]
> 	[-u EUIDLIST] [-U UIDLIST] [-G GIDLIST] [-t TERMLIST] [PATTERN]
> [root at server ~]# pkill "php
> -f /var/www/virtual/vtiger.server.com/modules/CalendarSync/syncCalendarFromGA.php > /home/mundane/etc_cron_rept2.txt 2>&1"
> 
> ??
> 
> Thanks.

Do you know the Parent Process ID? If so you can kill that and the
pattern. Also try this if no dice:

# pkill -9 -f syncCalendarFromGA.php ; \
pkill -9 -f syncCalendarFromGA.php ; \
pkill -9 -f syncCalendarFromGA.php ; \
pkill -9 -f syncCalendarFromGA.php ; \
pkill -9 -f syncCalendarFromGA.php ; \
pkill -9 -f syncCalendarFromGA.php

If that doesn't do it... then add "-P $PPID" before the "-f" where you
know the Parent ID in place of $PPID.

You also have to use "-f" with pkill to get it to match anything other
than "php" 

From the man page:

	-f, --full
		The pattern is normally only matched against the process
		name.  When -f is set, the full command line is used.

That is why I included it.

-- 
greg at gregfolkert.net
PGP key 1024D/B524687C 2003-08-05
Fingerprint: E1D3 E3D7 5850 957E FED0 2B3A ED66 6971 B524 687C
"Wherever you go, go with all your heart."
    -- Confucius
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://shinobu.grlug.org/pipermail/grlug/attachments/20130904/2cda898d/attachment.pgp>


More information about the grlug mailing list