您的位置:首页 > 运维架构

OpenWRT 设置脚本自动更新hosts访问不可描述的站点

2017-05-30 19:19 1511 查看
小米路由刷了PandoraBox之后简直就像发现了新大陆,各种好玩啊~今天又发现个计划任务很不错

01 06 * * * wget -q https://raw.githubusercontent.com/racaljk/hosts/master/hosts -O /etc/hosts --no-check-certificate ; /etc/init.d/dnsmasq restart


每天早上6:01会从github上下载最新的hosts文件更新路由器内部解析,可以打开不少不可描述的站点呢.

我SSH到路由器上先手工执行了一下计划任务,发现报错

[root@PandoraBox:/etc]#wget -q https://raw.githubusercontent.com/racaljk/hosts/master/hosts -O /etc/hosts --no-check-certificate
wget: not an http or ftp url: https://raw.githubusercontent.com/racaljk/hosts/master/hosts[/code] 
原来PandoraBox(其实也就是OpenWRT)里面默认的wget命令是由Busybox提供的,而且默认不支持https协议,于是在OpenWRT官网上找到了以下解决办法:

The default wget in OpenWRT is provided by Busybox, which does not support
SSL. If you want to use SSL (https) URLs, you can install the real wget:
opkg update
opkg install wget

/usr/bin/wget points
now to the full version.

搞定~嗨起来!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐