[GRLUG] problem with pkill/killall

Eric Beversluis ebever at researchintegration.org
Wed Sep 4 22:08:09 EDT 2013


     A. On Wed, 2013-09-04 at 20:15 -0400, Greg Folkert wrote:
> 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.
> 
========
Thanks, Greg. 
--There seem to be many different parent processes, so that approach
won't work here.
--I didn't grasp the meaning of the -f option because I was thinking
that the whole thing was the command--that's why I tried to put it in
quotes. I gather, thinking about what you wrote, that only 'php' is the
command.
--also, the examples I saw didn't use the -9. 

Thanks again.



More information about the grlug mailing list