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
2022-11-14 09:35:20
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