Click here to return to the KiXtart HelpDesk main page...

KiXtart Script Depot

Backup Exec Log Analyzer

; ScriptNavn:   BELOG.KIX
; Version:       1.0
; Udvikler:      Brian Petersen
; Dato:           14.11.1999
; Beskrivelse:  The Script retrieves Backup Exec's BExxx.LOG-file from Servers on the list SERVERS.TXT
;                    Server Name, Date and Status of all servers is compiled into LOG.TXT
;                    This is done by reading certain (fixed) positions in the BExxx.LOG.
;
; The file SERVERS.TXT looks like this:
;
; Server1
; Server2
; Server3
; Endlist
;


Break on

;del "C:\BElog\*.txt"

Open(1,C:\BElog\servers.txt)
	$server = ReadLine(1)
 	While $server <> "EndList"
	; Retrieve log file from server...

	; Open log and find file length on servers.txt...
	IF Open(3, "C:\BElog\servers.txt")  = 0
			$srvlist   = 0
			$read1 = ReadLine(3)
			WHILE @ERROR = 0
				$read1 = ReadLine(3)
				$srvlist = $srvlist + 1
			loop
		endif

	close(3)

	; Number of servers on the list and the one that is beeing processed...
	$serverliste = $srvlist - 1
	$counter = $counter + 1

	color w+/n
        cls
;	? "Processing:" $server
;	USE x: "\\$server\c$"
;	copy "x:\WINNT\backup.log" "C:\BElog\"
;	USE x: /delete

	; Start of data extraction...
	$length   = 0
	$endline4 = 0
	$newcount = 0

	; Open log and readline until counter = 5 then exit...
	$count3   = 0
	Open(3, "C:\BElog\backup.log")
	while   $count3 <> 5
		$date   = ReadLine(3)
		$count3 = $count3 + 1
		loop
	close(3)

;	? "Dato: " $date
	cls

	; Open log and find file length...
	IF Open(3, "C:\BElog\backup.log")  = 0
			$read = ReadLine(3)
			WHILE @ERROR = 0
				$read = ReadLine(3)
				$length = $length + 1
			loop
		endif

	close(3)

	; Open log and find data five lines from bottom...
	$endline4 = $length - 1
	Open(3, "C:\BElog\backup.log")
	WHILE   $newcount <> $endline4
		$log      =  ReadLine(3)
		$newcount =  $newcount + 1
	loop
	close(3)


	; User Interface...
   ;	
   cls
   ?
	color w+/n
   ? "                 B A C K U P   C H E C K"
	color y+/n
	? "                 Company XYZ"
        ?
	color g+/n
	? "                 Servers total:  " $serverliste
	? "                 Now processing: " $counter
 	? "                 Server:         " $server
	? "                 Backup status:  " $log
	? "                 Backup date:    " $date
;	? "Linies in log:  " $length
;	? "Endline4:       " $endline4
	?
	color w+/n
        ? ""

	:WriteData
	Open( 3 , "C:\BElog\log.txt" , 5 )
	$x = WriteLine( 3 , $server + " backed up " + $date + " - Status: " + $log + Chr(13) + Chr(10) )
	close(3)

	; End of data extraction...
	sleep 1
	SHELL "CMD /C rename C:\BElog\backup.log " + $server + ".txt"
	$server = ReadLine(1)
	loop
close(1)

?
? "                 Script terminated at " + @time
?
exit