Basically, you want to run ifconfig to get a list of which interfaces
are up and then look for ppp devices:
open IFCONFIG, "ifconfig |";
my @interfaces;
while(<IFCONFIG>){
next unless /^(ppp\d+)/;
push @interfaces, $1;
}
close IFCONFIG;
This should give you what an array of what interfaces are up. (Though I
should warn you I'm using RedHat and the output of ifconfig may be
different with SUSE).
Then you'll want to cycle through these interfaces, bringing down all
but ppp1:
for my $if (@interfaces){
system "ifdown $if" if $if ne 'ppp1';
}
- Johnathan
Ian McKenna wrote:
>Hi, I am new to PERL and have a relativly easy question.
>
>I have a SUSE Linux machine that does some dial-up, gathers infirmation
>from the servers I look after, however he dial up when shut down keeps a
>pppd deamon up, sometime I see at least 20 ppp1....ppp21 for example.
>I've tried to write a PERL script that simply list the pppd from
>ifconfig so it list all the pppds like this
>
>ppp1
>ppp2
>ppp3
>..
>..
>..
>ppp21
>
>I want ppp1 kelt up and all the rest killed off - anyone know how I can
>do this ?
>
>Regs Ian
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]