我这里是用华为的认证的,在ubuntu下每次开机都要运行“sudo linux1 -d“才能上网,多郁闷阿!所以我就写了个自动连接脚本,呵呵,很简单的一个!
要注意的是,这个脚本一定要在网络服务的后边启动~~不要超前哦~~~
#!/usr/bin/perl -w
use strict;
my $dir='/etc/init.d';
my $file='connect.sh';
my $common='sudo linux1x -d';
chdir $dir||die "can't chdir:$!\n";
if(-e $file)
{
print $file,' had been exit',"\n";
exit(0);
}
open FILE,">>",$file||die "can't open $file for write:$!\n";
print FILE $common;
close FILE;
chomp(my $level=`runlevel`);
$level=$1 if $level=~/([0-5])/;
symlink "$dir/$file","/etc/rc$level.d/S99connect.sh"||die "can't symlink:$!\n";
print "setting.............ok\nplease restart your coumper to test itworks or not\n";
#chdir "/var";
#rename "connect.sh","S30connect.sh"||die "can't rename:$!\n";
|
阅读(2308) | 评论(1) | 转发(0) |