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

小米路由刷了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

原来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.


搞定~嗨起来!

你可能感兴趣的:(运维)