Discuz! Board

找回密碼
立即註冊
搜索
熱搜: 活動 交友 discuz
發新帖

807

積分

好友

主題
發表於 2021-4-11 23:17:31 | 查看: 984| 回復: 0
#Script在RouterOS 5.15中測試通過
#Date:2010/12/19
#Script Name:MailBackupFile
#-----------------------------------------
#SMTP伺服器位置
:local SMTP "msa.hinet.net"

#寄件人 記得改寄件者
:local MailFrom "ROSBackup@minitw.com"

#收件人 記得改收件者
:local MailTo "ModifyHere@minitw.com"

#寄出後是否刪除已存檔的Log(/file裡的檔案)
#0=保留 1=刪除 需要修改檔案名稱喔

:local DeleteLogFile 1

:local BackupFileName
:set BackupFileName ([/system identity get name] . "_Backup-" . [:pick [/system clock get date] 7 11] . [:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6] . ".backup");
/system backup save name=($BackupFileName);
delay 10;

/tool e-mail set from=$MailFrom;
/tool e-mail set address=[:resolve $SMTP];

/tool e-mail send to=$MailTo subject=([/system identity get name] . " -- RouterOS Backup " . [:pick [/system clock get date] 7 11] . [:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6]) file=[$BackupFileName];

:delay 10;

:if ($DeleteLogFile =1) do={
/file rem [/file find name=($BackupFileName)];
}

:log info ("System Backup emailed at " . [/sys cl get time] . " " . [/sys cl get date] . " (CHT:備份email寄出)");

#---
#---
您需要登錄後才可以回帖 登錄 | 立即註冊

Archiver|手機版|小黑屋|維護技術論壇 SMEITO

GMT+8, 2024-12-4 16:03 , Processed in 0.160550 second(s), 25 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回復 返回頂部 返回列表