/export file=export_date_ters.rsc ters
Skrypt do zrzucania logów do pliku + wysyłanie ich na maila i FTP
System -> Scripts -> [+]
Name = "Logs_backup"
Source
# months array :local months ("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"); # get time :local ts [/system clock get time] :set ts ([:pick $ts 0 2].[:pick $ts 3 5].[:pick $ts 6 8]) # get Date :local ds [/system clock get date] # convert name of month to number :local month [ :pick $ds 0 3 ]; :local mm ([ :find $months $month -1 ] + 1); :if ($mm < 10) do={ :set mm ("0" . $mm); } # set $ds to format YYYY-MM-DD :set ds ([:pick $ds 7 11] . $mm . [:pick $ds 4 6]) # file name for logs backup - servername-YYYYMMDD-HHMMSS_logs.txt :local fname ([/system identity get name]."-".$ds."-".$ts."_logs.txt") :local sfname ("/".$fname1) # backup logs /log print file=$sfname1 :log info message="Logs backup finished (1/1)."; # ftp server :local ftphost "192.168.1.1" :local ftpuser "ftp_user" :local ftppassword "ftp_password" :local ftppath "/folder/subfolder/" # upload the system backup :log info message="Uploading logs backup (1/1)." /tool fetch address="$ftphost" src-path=$sfname1 user="$ftpuser" mode=ftp password="$ftppassword" dst-path="$ftppath/$fname" upload=yes # delay time to finish the upload - increase it if your backup file is big #:delay 30s; :local mname ([/system identity get name]." - Backup logs - ".$ds) :local mailTo "admin@domain.com" :local emailbody ("Plik z backupem logow: ".$sfname1) /tool e-mail send subject=$mname to=$mailTo body=$emailbody
Następnie należy dodać skrypt do Schedulera
System -> Scheduler -> [+]
Name = "Logs_backup" Interval ="1d 00:00:00" On Event /system script run Logs_backup
Aby włączyć automatyczną kopię zapasową przyrostową na komputerach i serwerach z windowsem należy:
1. Zainstalować SyncToy
https://www.microsoft.com/en-us/download/details.aspx?id=15155
Zobacz całość