功能导航:→
 
发新话题
打印

[原创]Linux下重新拨号的Perl脚本

[原创]Linux下重新拨号的Perl脚本

#! /usr/bin/perl
use strict;
use warnings;
my $tmpfile="/tmp/ppp0-tmp1234.txt";
my $lookfor="Link is down";
my $firstline;
system "/usr/sbin/adsl-status >$tmpfile";
open INF,"<$tmpfile" or die "Can't open file!";
$firstline = <INF>;
while(index($firstline, $lookfor)!=-1){
    close INF;
    system "/usr/sbin/adsl-stop";
    system "/usr/sbin/adsl-start";
    system "/usr/sbin/adsl-status >$tmpfile";
    open INF, "<$tmpfile" or die "Can't open file!";
    $firstline = <INF>;
    print $firstline,"\n";
}
print $firstline,"\n";
close INF;

“一般来说,教授的错误都需要由本科生来指出。” 对于上面的命题,我发现了一个美妙的证明,可惜这里空白太小,写不下了。 ──王聪大猜想 http://congwang.noads.info/index.html

TOP

发新话题