SHARE
TWEET

Backup Mikrotik ke FTP Server

kangpaidjo Dec 30th, 2019 24 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ##################################
  2. # Backup Mikrotik ke FTP Server
  3. # @paidjo.com 072017
  4. ##################################
  5.  
  6. # TULIS DENGAN HURUF BESAR dan "-" untuk lebih dari satu kata
  7. :local nama "ROUTER-PAIDJO-COM"
  8.  
  9. ## DO NOT EDIT FROM HERE TO THE END!
  10. # ftp configuration
  11. :local ftphost "192.168.2.248"
  12. :local ftpport "2121"
  13. :local ftpuser "user"
  14. :local ftppassword "password"
  15. :local ftppath "backup"
  16.  
  17. # months array
  18. :local months ("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec");
  19. #get Time
  20. :local tm [/system clock get time]
  21. :local jam [:pick $tm 0 2 ]
  22. :local menit [:pick $tm 3 5 ]
  23. :local detik [:pick $tm 6 8 ]
  24. :set $waktu ($jam.".".$menit.".".$detik)
  25. # get Date
  26. :local ds [/system clock get date]
  27. # convert name of month to number
  28. :local month [ :pick $ds 0 3 ];
  29. :local mm ([ :find $months $month -1 ] + 1);
  30. :if ($mm < 10) do={ :set mm ("0" . $mm); }
  31. # set $ds to format YYYY-MM-DD
  32. :set ds ([:pick $ds 7 11] . $mm . [:pick $ds 4 6])
  33.  
  34. # create backup
  35. /system backup save name="RB-$nama-backup";
  36. /export compact file="RB-$nama-rsc";
  37. :delay 3s;
  38. :log info message="Configuration backup created";
  39. # upload backup
  40. /tool fetch address="$ftphost" user="$ftpuser" password="$ftppassword" mode=ftp port="$ftpport" src-path="RB-$nama-backup.backup" dst-path="$ftppath/RB-$nama-$ds-$waktu.backup" upload=yes;
  41. /tool fetch address="$ftphost" user="$ftpuser" password="$ftppassword" mode=ftp port="$ftpport" src-path="RB-$nama-rsc.rsc" dst-path="$ftppath/RB-$nama-$ds-$waktu.rsc" upload=yes;
  42. :delay 10s;
  43. :log info message="Upload configuration success!";
  44. # EOF
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top