RouterOS 脚本实现每日自动备份配置并上传到NAS
Robola
编辑于 2024年03月23日 00:19
收录于文集
共12篇

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

代码块
Shell
自动换行
复制代码
: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

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

代码块
Shell
自动换行
复制代码
/delay delay-time=2s
/file/remove [:pick ($filename.".rsc") 1 999]
复制成功

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