专栏/RouterOS 脚本实现每日自动备份配置并上传到NAS

RouterOS 脚本实现每日自动备份配置并上传到NAS

2024年03月22日 08:19--浏览 · --点赞 · --评论
粉丝:174文章:12

1. 首先,在【System】-【Scripts】中,新建脚本,命名为backup to ftp

:local date [/system clock get date]
:local filename ("/rosbackup_".[/system identity get name]."-".$date)
/export file=($filename.".rsc");
/tool fetch address=你的NASIP upload=yes user=NAS用户名 password=NAS密码 port=21 mode=ftp src-path=($filename.".rsc") dst-path=("/home/Backup/ROS/".$filename.".rsc")

2. 在【System】-【Scheduler】中,新加定时任务,每天零点五十分,自动生成配置,并且上传到NAS

(可以根据需求,在脚本最后加一行

/delay delay-time=2s
/file/remove [:pick ($filename.".rsc") 1 999]

,删掉路由本地的备份配置文件)


投诉或建议