Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Jun 2002 17:09:37 +0800
From:      S H A N <shanali@singnet.com.sg>
To:        freebsd-questions@FreeBSD.ORG
Subject:   Re: How do I make a stop script
Message-ID:  <20020615090937.GA22317@singapura.singnet.com.sg>
In-Reply-To: <547866371.20020615105033@e-box.dk>
References:  <547866371.20020615105033@e-box.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
hi,

put the three lines in a file say killjava.sh and run it like 

#sh -x killjava.sh

#!/bin/sh
PID=`ps auxw |grep "proximus"|awk '{ print $1}'`
kill -9 $PID

for explanation pls refer to 

$man ps
$man grep
$man awk
$man kill

rgds,

On Sat, Jun 15, 2002 at 10:50:33AM +0200, Søren Neigaard wrote:
> I am in urgent need to make a stop script for a Debian machine, I have
> asked this question on the Debian list, but this is the fastest and
> best list I know of, and since it should be almost the same for
> FreeBSD, I will give it a go here too.
> 
> My Debian is running bash.
> 
> I need to make a script that can find the PID for a Java application,
> where the process string contains 'proximus', and 'kill -9' that
> process. My Java process spawns quite some threads, so I need to kill
> the main process, not one of the threads.
> 
> How do I do this, I have no clue, and no shell programming experience,
> so please explain it to me carefully, a complete example would just be
> great, with some explanation so I don't have to ask again :)
> 
> --
> Med venlig hilsen/Best regards,
>  Søren Neigaard mailto:neigaard@e-box.dk
> --
>  "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message

-- 
S H A N

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?20020615090937.GA22317>