Linux教程

国内Linux Server添加自动更新Github解析

本文主要是介绍国内Linux Server添加自动更新Github解析,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

1.先写脚本:gethosts,给予权限0755.

#!/bin/bash
sed -i "/# GitHub Host Start/Q" /etc/hosts && curl https://gitee.com/ineo6/hosts/raw/master/hosts >> /etc/hosts

2.添加定时任务

crontab -e    # 进入编辑,输入i进入编辑模式,:wq保存编辑

0 */2 * * * 替换为脚本绝对路径  > /dev/null 2>&1

 

这篇关于国内Linux Server添加自动更新Github解析的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!