Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :local smtpserv [:resolve "smtp.yandex.ru"];
- :local smtpport "587";
- :local emailfrom "router@svc.sacon.ru";
- :local pass "1111111111";
- :local emailto "backup@svc.sacon.ru";
- :local name [/system identity get name];
- :local time [/system clock get time];
- :local date [/system clock get date];
- :local day [:pick $date 4 6]
- :local month [:pick $date 0 3]
- :local year [:pick $date 7 11]
- :local datetime "$day-$month-$year $time"
- :local dateprefix "$year-$month-$day_$time"
- :log info "Backup started on $name at $datetime";
- :local backupfile ("backup-" . $name . "-" . $dateprefix . ".backup");
- :local exportfile ("export-" . $name . "-" . $dateprefix . ".txt");
- :log info "Backup config";
- /system backup save dont-encrypt=yes name=$backupfile;
- :delay 5;
- :log info "Export config";
- /export file=$exportfile;
- :delay 3;
- :local backupbody "Mikrotik backup config $name $datetime";
- :local exportbody "Mikrotik export config $name $datetime";
- :log info "Send backup to email";
- /tool e-mail send server=$smtpserv port=$smtpport user=$email password=$pass start-tls=yes to=$emailto from=$email subject="$backupbody" body="$backupbody" file=$backupfile;
- :delay 20;
- :log info "Send export to email";
- /tool e-mail send server=$smtpserv port=$smtpport user=$email password=$pass start-tls=yes to=$emailto from=$email subject="$exportbody" body="$exportbody" file=$exportfile;
- :delay 20;
- :log info "Remove backup and config files";
- /file remove $backupfile;
- /file remove $exportfile;
- :log warning "Backup, export e-mail finished";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement