X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Jim Seymour Subject: Re: How do I kill a grandchild process from shell program? Date: Tue, 24 Oct 2006 11:12:50 -0700 Lines: 26 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) In-Reply-To: X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Lev Bishop wrote: > On 10/23/06, Jim Seymour wrote: > >> However, if things don't work fine, the background process sticks around >> to plague me later. >> >> I'd like to end my main script by killing the background process (if >> it's still around), but I'm having a helluva time figuring out HOW. > > How about: > $ killall Thanks for the reply. Unfortunately, "killall" is not part of my Cygwin installation - and I don't see which package contains it. However, I may have solved my problem with this lovely mess: kill $! kill `ps | grep ocdremote | tr -s " " | cut -f2 -d " "` The first "kill" stops the background bash process. The second stops the utility in question. Not as elegant as I'd hoped, but it seems to do the trick. -- Jim Seymour -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/