KILLING Processes in unix



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


Relevant Pages

  • killing processes
    ... I need to kill java processes in Unix and windows both based on OS check. ... ";(this command work if i put in command prompt of the linux box) ...
    (perl.beginners)
  • generally, go lift a frog
    ... excuses the barbers frantically, Pauline won't kill any hollow ... windows. ... Dave weekly creeps them too. ...
    (rec.pets.cats.anecdotes)
  • <<SASSER Removal instructions>>
    ... Vulnerable Windows 2000 and Windows XP machines may have the LSASS.EXE ... installation of the patch as well as removal of the worm. ... Kill any process starting with 'avserv' (i.e. avserve.exe, ...
    (microsoft.public.backoffice.smallbiz)
  • <<SASSER Removal instructions>>
    ... Vulnerable Windows 2000 and Windows XP machines may have the LSASS.EXE ... installation of the patch as well as removal of the worm. ... Kill any process starting with 'avserv' (i.e. avserve.exe, ...
    (microsoft.public.backoffice.smallbiz2000)
  • <<SASSER Removal instructions>>
    ... Vulnerable Windows 2000 and Windows XP machines may have the LSASS.EXE ... installation of the patch as well as removal of the worm. ... Kill any process starting with 'avserv' (i.e. avserve.exe, ...
    (microsoft.public.windows.server.sbs)