Last active
September 13, 2022 15:39
-
-
Save nilsonpessim/776667429fc275a8a76cd4982282254d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:local company TECHLABS | |
:local hostFTP HOST-FTP | |
:local portFTP 21 | |
:local userFTP usuario-FTP | |
:local passFTP senha-FTP | |
:local telegramId id-telegram | |
:global nomeMikrotik ([/system identity get name]) | |
:global versaoOS ([/system resource get version]) | |
:global arch ([/system resource get architecture-name]) | |
:log warning "$company : [INFO] Iniciando Backup via FTP " | |
:global backupfile "$nomeMikrotik_$versaoOS_$arch"; | |
:delay 5s | |
:log warning "$company : [INFO] Gerando Arquivos de Backup..." | |
/export file=$backupfile | |
:delay 2s | |
/system backup save name=$backupfile | |
:delay 2s | |
:log warning "$company : [INFO] Preparando arquivos para serem enviado..." | |
/tool fetch address=$hostFTP src-path="$backupfile.rsc" user=$userFTP port=$portFTP password=$passFTP upload=yes mode=ftp dst-path="$backupfile.rsc" | |
:delay 5s | |
/tool fetch address=$hostFTP src-path="$backupfile.backup" user=$userFTP port=$portFTP password=$passFTP upload=yes mode=ftp dst-path="$backupfile.backup" | |
:delay 5s | |
:log warning "$company : [SUCESSO] Arquivos enviados com sucesso!" | |
:delay 2s | |
:log warning "$company : [INFO] Removendo arquivos do diretorio principal" | |
/file remove "$backupfile.rsc" | |
/file remove "$backupfile.backup" | |
:delay 2s | |
:log warning "$company : [SUCESSO] Arquivos Removidos!" | |
:delay 2s | |
:log warning "$company : [INFO] Notifica Telegram" | |
/tool fetch url="https://api.telegram.org/botTOKEN/sendMessage?chat_id=$telegramId&text=Host: $nomeMikrotik - Backup Realizado!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment