linux使用git时传输速度太低,提速
下面是我自己写的脚本:
#!/bin/bash # author TommyWang # website http://dynmi.top fast_ip=`nslookup github.global.ssl.fastly.Net|egrep ‘[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}‘` fast_ip=${fast_ip##*:} git_ip=`nslookup github.com|egrep ‘[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}‘` git_ip=${git_ip##*:} echo "${fast_ip}" echo "${git_ip}" sed -i ‘/github.global.ssl.fastly.Net/d‘ /etc/hosts sed -i ‘/github.com/d‘ /etc/hosts echo "github.global.ssl.fastly.Net${fast_ip} github.com${git_ip}" >> /etc/hosts sudo systemctl restart nscd
将它加入到crontab 定时执行中,必须是root身份,在/etc/crontab中追加(修改脚本地址)
10 10 * * * root /home/dynmi/Documents/essential_bash/refresh_git_ip.sh
相关推荐
farwang 2020-11-25
星愿心愿 2020-11-24
tianhuak 2020-11-24
zhjn0 2020-11-24
昭君出塞 2020-11-23
bluecarrot 2020-11-23
linuxwcj 2020-10-21
以梦为马不负韶华 2020-10-20
彼岸随笔 2020-10-20
yutou0 2020-10-17
applecarelte 2020-10-16
ourtimes 2020-10-16
waterhorse 2020-09-19
MRFENGG 2020-11-11
rainandtear 2020-10-30
kyssfanhui 2020-10-20
liuhangtiant 2020-10-20