openwrt里面有appfilter这个插件,但是这个插件没有定时开启或者关闭的功能。最近孩子每天要玩一会游戏看一会抖音,每次都手动设置实在不胜其烦,研究了一下,可以利用定时任务实现定时开启或者关闭appfilter的功能。
定时开启限制玩游戏看视频
uci set appfilter.@global[0].enable=1
uci commit appfilter.@global[0].enable
/etc/init.d/appfilter restart
定时关闭同理:
uci set appfilter.@global[0].enable=0
uci commit appfilter.@global[0].enable
/etc/init.d/appfilter restart
新版本的openwrt改变了commit的方法。之前可以uci commit就能实现配置的保存,现在会报错。
root@J1900:~# uci commit
uci: Entry not found
只能uci commit appfilter.@global[0].enable指定保存某个具体值。
改进了一下,直接写成一个脚本文件,放在mnt下面,chmod 777 设置可执行权限,然后定时任务直接指定该脚本运行即可。