Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.38 KB | None | 0 0
  1. {
  2. :log info "Starting backup script...";
  3. :local Eaccount "mikrotback@gmail.com";
  4. :local sysname [/system identity get name];
  5. :local localSubj "Empty"
  6. :local localBody "Empty"
  7. :log info "Flushing DNS cache...";
  8. /ip dns cache flush;
  9. :delay 2;
  10. :local smtpserv [:resolve "smtp.gmail.com"];
  11.  
  12.  
  13. :log info "localSubj= $localSubj ";
  14. :if ( !($localSubj = "Empty")) do={
  15.  
  16. :log info "Deleting last Backups...";
  17. :foreach i in=[/file find] do={:if ([:typeof [:find [/file get $i name] \
  18. "$sysname-backup-"]]!="nil") do={/file remove $i}};
  19. ###:delay 2;
  20. ###:do {/file remove $ChangelogFilename} on-error={};
  21.  
  22. ## Backup configuration
  23. :local backupfile ("$sysname-backup-" . \
  24. [:pick [/system clock get date] 7 11] . [:pick [/system \
  25. clock get date] 0 3] . [:pick [/system clock get date] 4 6] . ".backup");
  26. :log info "Creating new Full Backup file...";
  27. /system backup save name=$backupfile;
  28. :delay 5;
  29. }
  30. :local exportfile ("$sysname-backup-" . \
  31. [:pick [/system clock get date] 7 11] . [:pick [/system \
  32. clock get date] 0 3] . [:pick [/system clock get date] 4 6] . ".rsc");
  33. :log info "Creating new Setup Script file...";
  34. /export file=$exportfile;
  35. :delay 5;
  36.  
  37. :log info "Sending Full Backup file via E-mail...";
  38. /tool e-mail send to=$Eaccount server=$smtpserv \
  39. port=587 start-tls=yes file=($backupfile ."," . $exportfile . ) \
  40. subject=("$localSubj") \
  41. body=("$localBody");
  42. :delay 10;
  43.  
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement