killing processes
- From: perlpra@xxxxxxxxx (Perl Pra)
- Date: Fri, 27 Oct 2006 15:18:45 +0530
hi
I need to kill java processes in Unix and windows both based on OS check.
here is my code
use Switch;
my $UKILLSTR="ps -ef |grep java | grep -v grep|kill -9 `awk '{print $2}'`
";(this command work if i put in command prompt of the linux box )
my $UKILLSTR1="
my $WKILLSTR="taskkill /IM java.exe /F";
my $OS=$^O;
switch ($OS) {
case "MSWin32" { system("$UKILLSTR"); }
case "LINUX" { system("$UKILLSTR");}
else { print "INVALID OS \n";}
}
for windows my script is killing the Java processes if i run it in unix or
linux iam getting the following error
kill: "`awk" is not a job
kill: "{print }`" is not a job
grep: write error on standard output: The pipe is being closed.
need solution for above .
and Is there any way in perl to kill processes independent of OS .. If there
is hwo can i do that ?
wating for solutions.
Thanks
Perl Pra
- Prev by Date: Re: Analize Java source file with perl?
- Next by Date: Re: Spam from this list
- Previous by thread: Re: Help, using script to edit router config (entering different modes automatically)
- Next by thread: how do i use page text method...
- Index(es):
Relevant Pages
|