[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Omaha.pm] FW: killall.pl
You meant expedia_kill.pl.
Ya. Now you could rewrite expedia_kill.pl in 1 line of perl:
`killall.pl exped`;
Grin,
j
> -----Original Message-----
> From: Sean Baker [mailto:pbaker@omnihotels.com]
> Sent: Monday, February 07, 2005 8:53 AM
> To: 'Jay Hannah'
> Subject: RE: killall.pl
>
> This looks strangely familiar to:
>
> http://cvs/source/MVC/View/Expedia/perl/kill_exped.pl?rev=1.2&content-type=text/vnd.viewcvs-markup
>
> but it allows ARGSV[0], and it's three times the size.
>
> Sean Baker
> Software Architect
> Omni Hotels
> (402) 952-6508
> pbaker@omnihotels.com
>
> -----Original Message-----
> From: Jay Hannah [mailto:jhannah@omnihotels.com]
> Sent: Sunday, February 06, 2005 12:45 PM
>
>
> I wrote a new program. AIX's killall still stinks I got sick of trying to
> kill a bunch of processes manually (orphan palsrqs).
>
> It lives in /oexec/__oscripts, so if you have that in your path you could:
>
> killall.pl palsrq
>
> To kill off all orphan palsrq processes. Or
>
> killall.pl prcavai
>
> To kill off all prcavai's if theres 20 running accidentally.
>
> Etc...
>
> (killall on Linux has done this for years.)
>
> FWIW,
>
> j
>
>
>
---------------------------------------------------------
#!/usr/bin/perl
# grrr... aix's toolset sucks
# Write our own killall...
unless ($ARGV[0]) {
usage();
}
my @killthese;
open (IN, "ps -ef |");
while (<IN>) {
next unless (/$ARGV[0]/);
next if (/killall/);
#print;
chomp;
@l = split /\s+/;
push @killthese, $l[1];
}
close IN;
foreach (@killthese) {
#print "kill $_\n";
system("kill $_");
}
sub usage {
print <<EOT;
killall.pl palsrq
Runs "ps -ef" and kills all processes which contain the string
"palsrq".
EOT
exit;
}