gbudny93.RouterOS_Useful_Sc.../RouterOS_Mail_Backup.rsc

27 lines
940 B
Text
Raw Normal View History

2019-10-14 20:53:37 +02:00
# RouterOS Function
# Copyright (c) Grzegorz Budny
2019-12-01 11:28:00 +01:00
# Creates RouterOS backup and config file and sends them via email
2019-10-14 20:53:37 +02:00
:global MailBackup do={
:local systemName [/system identity get name];
:log info "...:::Mail backup started:::...";
/export file=$configName;
/system backup save name=$backupName;
/tool e-mail send server=$smtpServer port=$smtpPort from=($systemName.$domain) \
to=$recipient subject=($systemName." mail config backup") body="Enclosed backup files" \
file=$configName;
/tool e-mail send server=$smtpServer port=$smtpPort from=($systemName.$domain) \
to=$recipient subject=($systemName." mail backup") body="Enclosed backup files" \
file=$backupName;
:log info ("...:::Backup files sent to".$recipient.":::...");
}
$MailBackup configName=configName backupName=backupName smtpServer=smtpServer smtpPort=smtpPort domain=@example.com \
recipient=recipient@example.com;