找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 11178|回复: 15

ROS 国内分流地址---每日自动更新脚本说明

[复制链接]
本帖最后由 jmes2@163.com 于 2021-2-25 22:51 编辑

分流设置请参考此贴:https://www.right.com.cn/forum/forum.php?mod=viewthread&tid=4050513&page=1&extra=#pid10911613

效果图:

1、首先搭建下载服务器
建议用debian 10,启动快速,安装简单,设置好静态IP,直接访问地址即可看到更新的文件!

1 安装nginx
sudo apt-get install nginx
2 创建conf文件
nano /etc/nginx/conf.d/file_server.conf
修改conf文件如下:
server {
listen 80; # 监听端口
server_name 10.1.2.3; # 自己PC的ip或者服务器的域名
charset utf-8; # 避免中文乱码
root /home/xx/share; # 文件路径 这个路径根据自己的实际设置,路径的目录必须要建立了才可以,不然会报错,如自己的是:/home/jmes2,此处就是:root /home/jmes2;
location / {
autoindex on; # 索引
autoindex_exact_size on; # 显示文件大小
autoindex_localtime on; # 显示文件时间
}
}
3 使配置生效
sudo rm /etc/nginx/sites-enabled/default
sudo service nginx reload
4 访问
浏览器里直接输入 http://10.1.2.3

5 nginx其他命令
sudo /etc/init.d/nginx start|stop|reload|
sudo service nginx start|stop|reload|

2、debian  每日自动更新脚
1、首先添加Crontab定时任务,用来每日定时执行脚本,将脚本上传到linux 系统目录,执行 chmod  +x cnip.sh   授权, ./cnip.sh 运行,即可在当前目录生成cnip.rsc文件!
nano /etc/crontab
0 12 * * * root /root/cnip.sh
脚本汇总6个国内IP地址列表,将个6个文件去重汇总成一个CNIP.RSC文件,然后复制到NGINX目录(默认不移动,如需移动,请去除注释并设置路径),即可通过浏览器访问:http://192.168.1.6/cnip.rsc,就可以看到文件了,然后用ROS添加的脚本定时执行即可!
脚本文件下载:

3、ROS添加脚本---自动下载Debian 生成的分流文件  cnip.rsc,导入防火墙!

自动下载设置:
# Update blocked.rsc
/tool fetch mode=http url="http://192.168.1.6/cnip.rsc" \
dst-path=cnip.rsc
/im file=cnip.rsc
:log info ([/file get blocked.rsc contents])
ROS定时执行脚本:
:execute script="script1"

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
我的恩山、我的无线 The best wifi forum is right here.
看看有什么不一样
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

看起来很流弊
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

支持一下  多谢楼主哈
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

你好 现在我有一个问题,就是,我是UBuntu,现在6个文件去重汇总成一个CNIP.RSC文件,这一步上出现错误了,6个文件能出现,但是汇总不了  ,请问一下是怎么回事?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
Keliwei 发表于 2021-5-22 21:39
你好 现在我有一个问题,就是,我是UBuntu,现在6个文件去重汇总成一个CNIP.RSC文件,这一步上出现错误了 ...

我是debian搭建的,root模式运行!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

本帖最后由 1350962574 于 2021-7-24 12:07 编辑

ROS脚本可以按照我的 这样ROS执完脚本后自动删除cnip.rsc避免占用空间
/tool fetch mode=http url="http://10.0.0.2/cnip.rsc" \
dst-path=cnip.rsc
/im file=cnip.rsc
/file remove [find name=cnip.rsc"]
:log info ([/file get blocked.rsc contents])


点评

/file remove [find name=cnip.rsc"] 少了个引号亲  详情 回复 发表于 2021-8-5 19:45
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

求个成品吧,这个ip定期更新也可以
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

来自手机 | 显示全部楼层
server_name 10.1.2.3; # 自己PC的ip或者服务器的域名,
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

本帖最后由 tty228 于 2022-6-8 23:58 编辑
  1. # 下载文件
  2. /tool fetch url=http://www.iwik.org/ipcountry/mikrotik/CN
  3. # 避免日志被刷屏
  4. /system logging disable 0
  5. # 载入列表
  6. /import file-name=CN
  7. # 恢复日志输出
  8. /system logging enable 0
  9. # 查看当前列表数量
  10. :local CN [:len [/ip firewall address-list find list="CN"]]
  11. # 删除文件
  12. /file remove [find name="CN"]
  13. # 写入日志
  14. :log info ("CN列表更新:"."$CN"."条规则")
复制代码
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

1350962574 发表于 2021-7-24 12:04
ROS脚本可以按照我的 这样ROS执完脚本后自动删除cnip.rsc避免占用空间
/tool fetch mode=http url="http:/ ...

/file remove [find name=cnip.rsc"]
少了个引号亲
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

tty228 发表于 2021-8-5 19:45
/file remove [find name=cnip.rsc"]
少了个引号亲

看走眼 意外意外
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

debian运行脚本哪里看不懂,不知道上传到哪个目录,输入执行命令之后提示没有那个文件或目录,浏览器输入debian的ip可以打开nginx的后台的。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

这么好的帖子,顶起来
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

欢迎大家光临恩山无线论坛上一条 /1 下一条

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-30 01:08

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表