Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Jan 2003 16:25:36 -0600
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Josh Brooks <user@mail.econolodgetulsa.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: how to kill a while loop...
Message-ID:  <20030128222536.GG17299@dan.emsphone.com>
In-Reply-To: <20030128140811.O54977-100000@mail.econolodgetulsa.com>
References:  <20030128140811.O54977-100000@mail.econolodgetulsa.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Jan 28), Josh Brooks said:
> 
> Hi,
> 
> I ran a command like:
> 
> while `some command` ; do something ; done &
> 
> and I missed the PID output when I backgrounded it.
> 
> Now I want to kill this while process, but I cannot find it anymore.
> 
> I tried to ps auxw | grep while, and grep do and so on, but I cannot find
> the process to kill it.

Two ways: 

1 - Type in "jobs -l", which will list all the backgrounded jobs your
    shell knows about and their pids.  Then run "kill nn", where nn is
    the process id, which is the second number.  The first is the job
    number, which will usually be 1.
 
2 - If you exited your shell or disowned the job, it won't show up in
    'jobs'.  Run "ps axl | egrep 'mycommand|PID'", and kill the
    command's parent process (PPID column).

-- 
	Dan Nelson
	dnelson@allantgroup.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030128222536.GG17299>