forked from gbudny93/RouterOS_Useful_Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRouterOS_FTP_Backup.rsc
31 lines (22 loc) · 1.17 KB
/
RouterOS_FTP_Backup.rsc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# RouterOS Function
# Copyright (c) Grzegorz Budny
# Version 1.0
# Last update: 2/14/2020
# Makes device backup and configuration backup, sends files to FTP server
:global FTPBackup do={
:local systemName [/system identity get value-name=name];
:log info "...:::FTP backup job started:::...";
/export file=$configName;
/system backup save name=$backupName;
/tool fetch src-path=$configName mode=ftp dst-path=$destPath \
user=$ftpUser password=$ftpPassword port=21 upload=yes \
address=$ftpServer;
/tool fetch src-path=$backupName mode=ftp dst-path=$destPath \
user=$ftpUser password=$ftpPassword port=21 upload=yes \
address=$ftpServer;
/tool e-mail send server=$smtpServer port=$smtpPort from=($systemName.$domain) \
to=$recipient subject=($systemName." FTP backup job completed") body=("FTP backup job completed to ".$ftpServer) \
:log info ("...:::Backup files sent to".$recipient.":::...");
}
$FTPBackup configName=configName backupName=backupName smtpServer=smtpServer smtpPort=smtpPort [email protected] \
[email protected] destPath=destPath ftpUser=user ftpPassword=password ftpServer=ftpserver;