Backup
نسخة احتياطية يومية عبر الايميل — 7
ينشئ كل يوم نسخة احتياطية للنظام وملف تصدير للإعدادات ويرسلها إلى بريدك ثم يحذف الملفات المؤقتة.
RouterOS 7
:local GmailID "sender@gmail.com";
:local GmailPWD "xxxxxxxxxxxxxxxx";
:local ToAddr "rec@gmail.com";
/tool e-mail set server=smtp.gmail.com port=587 tls=starttls from=$GmailID user=$GmailID password=$GmailPWD;
:local GDate [/system clock get date];
:local GResult ([:pick $GDate 4 6]." ".[:pick $GDate 0 3]." ".[:pick $GDate 7 11]);
:local BackupConf ([/system identity get name].".backup");
:local ExportConf ([/system identity get name].".rsc");
/system backup save name=$BackupConf;
:log info message="System backup finished (1/3).";
/export compact file=$ExportConf;
:log info message="Config export finished (2/3).";
:delay 3s;
:log info message="Sending system backup (3/3).";
/tool e-mail send to=$ToAddr subject="Configuration BACKUP of $GResult-$BackupConf" file=$BackupConf body="Backup attached";
:delay 20s;
:log info message="Sending config export (3/3).";
/tool e-mail send to=$ToAddr subject="Configuration BACKUP of $GResult-$ExportConf" file=$ExportConf body="Export attached";
:delay 50s;
:log info "Deleting backup files.";
/file remove $BackupConf;
/file remove $ExportConf;
:log info message="Configuration backup finished.";