/log warning "Create variables"
:local currentDate "$[/system clock get date]"
:local id "$[/system identity get name]"
:local BackupName ("$id-backup-".[:pick $currentDate 7 11]."-".[:pick $currentDate 0 3]."-".[:pick $currentDate 4 6].".backup")
:local ConfigName ("$id-config-".[:pick $currentDate 7 11]."-".[:pick $currentDate 0 3]."-".[:pick $currentDate 4 6].".rsc")
:local array [:toarray ""]
# Setup FTP params
# FTP IP address no quotes, ex: 10.10.10.200
:local ftp ip-address
:local user "login"
:local password "password"
# ftp path without file name
:local path "/ftp path/"
########################################
/log warning "Creating backup file"
/system backup save name="$BackupName" dont-encrypt=no;
# add filename to array
:set $array ($array, $BackupName);
:delay 2s
/log warning "Creating config file"
/export terse file="$ConfigName";
:set $array ($array, $ConfigName);
:delay 2s
:foreach file in=$array do={
/log warning "Uploading $file"
/tool fetch address=$ftp src-path=$file user=$user mode=ftp password=$password dst-path=($path.$file) upload=yes;
/log warning "$file has been uploaded"
:delay 3s
/file remove $file
:delay 10s;
};
/log warning "Done"
Last active
May 11, 2021 08:27
-
-
Save i386net/de90a3767400770aa697f27b1dc28f57 to your computer and use it in GitHub Desktop.
Mikrotik backup to ftp
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment