Ubuntu Server批量ping选择最快源linux效劳器应用 电脑资料
在虚拟机上操作shell实在不方便,索性把虚拟机做成效劳器,用putty连上去玩...学了一下根底的Linux脚本编程,正好拿来检测最快源,备份一下方法,
之前我在Ubuntu Server下用 sudo passwd root 启用了 root 用户,如果你没有启用,记得在命令前加"sudo"。
1、备份源列表文件 cp /etc/apt/sources.list /etc/apt/sources.list.bak
2、用vim翻开源列表文件 vim sources.list
3、按下Esc,然后全选并删除(ggdG),把新的源粘贴上去,保存退出(:wq)。我挨个ping了一下,觉得下面这2个最适合我,保存记录一下。"intrepid"是8.04的代号,如果是9.04的话改成"jaunty"就行了。
deb debian.ustc./Ubuntu/ intrepid main multiverse restricted universe
deb debian.ustc./Ubuntu/ intrepid-backports main multiverse restricted universe
deb debian.ustc./Ubuntu/ intrepid-proposed main multiverse restricted universe
deb debian.ustc./Ubuntu/ intrepid-security main multiverse restricted universe
deb debian.ustc./Ubuntu/ intrepid-updates main multiverse restricted universe
deb-src debian.ustc./Ubuntu/ intrepid main multiverse restricted universe
deb-src debian.ustc./Ubuntu/ intrepid-backports main multiverse restricted universe
deb-src debian.ustc./Ubuntu/ intrepid-proposed main multiverse restricted universe
deb-src debian.ustc./Ubuntu/ intrepid-security main multiverse restricted universe
deb-src debian.ustc./Ubuntu/ intrepid-updates main multiverse restricted universe
deb nz.archive.Ubuntu./ubuntu/ intrepid main restricted universe multiverse
deb nz.archive.Ubuntu./ubuntu/ intrepid-security main restricted universe multiverse
deb nz.archive.Ubuntu./ubuntu/ intrepid-updates main restricted universe multiverse
deb nz.archive.Ubuntu./ubuntu/ intrepid-backports main restricted universe multiverse
deb nz.archive.Ubuntu./ubuntu/ intrepid-proposed main restricted universe multiverse
deb-src nz.archive.Ubuntu./ubuntu/ intrepid main restricted universe multiverse
deb-src nz.archive.Ubuntu./ubuntu/ intrepid-security main restricted universe multiverse
deb-src nz.archive.Ubuntu./ubuntu/ intrepid-updates main restricted universe multiverse
deb-src nz.archive.Ubuntu./ubuntu/ intrepid-backports main restricted universe multiverse
deb-src nz.archive.Ubuntu./ubuntu/ intrepid-proposed main restricted universe multiverse
5、更新一下源 apt-get update
6、更新一下已安装的软件包 apt-get upgrade ,当然如果你想更新整个系统到最新发行版也可以 apt-get dist-upgrade
唔,为了方便以后测试源速度,干脆写一个脚本批量检测好了,
vim ping.sh 新建一个文件,写入以下脚本并保存。
#!/bin/sh
for ip in `cat testlist`
do
ping -c 5 -q $ip;
done
新建一个testlist文件保存源域名 vim testlist
nz.archive.Ubuntu.
archive.Ubuntu.
mirrors.163.
.archive.Ubuntu.
ubuntu vim命令mirror.lupaworld.
alss.
Ubuntu.uestc.
.britepic
ftp.sjtu.
debian.ustc.
u.tw
uide
tw.archive.Ubuntu.
这里要先 chmod 755 ping.sh 给它执行权限,然后运行 ./ping.sh 即可,结果会显示在屏幕上。为了简单我给ping命令加了 -q 参数只显示最后的统计结果,连续 ping 5次。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论