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

Reply via email to