Backup

نسخة احتياطية يومية عبر الايميل — 6

ينشئ كل يوم نسخة احتياطية للنظام وملف تصدير للإعدادات ويرسلها إلى بريدك ثم يحذف الملفات المؤقتة.

إصدار ⁨MikroTik⁩

RouterOS 6

:local GmailID "sender@gmail.com";
:local GmailPWD "xxxxxxxxxxxxxxxx";
:local ToAddr "rec@gmail.com";
:local GmailSMTP [:resolve "smtp.gmail.com"];

/tool e-mail set address=$GmailSMTP port=587 start-tls=yes 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.";