From: Mark Lambert <markl@fulcrum.com.au>
Subject: Re: killing a process by name?
Date: 1999/06/09 [thread overview]
Message-ID: <375DBA80.76E3B5FA@fulcrum.com.au> (raw)
In-Reply-To: 375d6a41.14695581@news.aurora.edu
Christopher Kolar wrote:
>
> Hello everyone. This is probably a basic question, but I have not
> found the solution yet so I thought I would float it. I have a host
> running OSF 4.0d. After everyone leaves for the day I am going to
> have cron start a program "foo". Foo should run until midnight, when
> it needs to be killed so that out nightly backups can happen.
>
Serguei Patchkovskii had a more elegant awk solution, but mine is (I think)
more understandable for non-awk guru's...
the brute force approach :0
try
kill `ps -ef | grep foo | grep -v grep | awk '{print $2}'`
that is:
kill (the numbers returned from the ``comand):
ps piped into a grep for foo, then discard the process running the grep
command, pipe the resulting ps line(s) into awk printing only the PID field.
Have fun!
--
/\ The Fulcrum Consulting Group Mark Lambert - Consultant
/\O\ Professional Services For Operation Mark.Lambert@fulcrum.com.au
/ /\ Of A Networked Computing Environment ph: +61-3-9621-2100
/o | \ 12/10-16 Queen St, Melbourne VIC 3000, Australia fx: +61-3-9621-2724
next prev parent reply other threads:[~1999-06-09 4:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-06-08 4:00 killing a process by name? Christopher Kolar
1999-06-08 4:00 ` Serguei Patchkovskii
1999-06-09 4:00 ` Javier de Burgos
1999-06-09 4:00 ` Jeff Denham
1999-06-16 4:00 ` Tim Mooney
1999-06-16 4:00 ` Jeff Denham
1999-06-09 4:00 ` Mark Lambert [this message]
1999-06-09 4:00 ` Paul David Fardy
1999-06-09 4:00 ` Adam Price
1999-06-10 4:00 ` Bruno KRINER
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox