Page 1 of 1 1
Topic Options
#34800 - 2003-01-06 05:02 PM Backup Log Files Script
Richie19Rich77 Offline
Seasoned Scripter
*****

Registered: 2002-08-16
Posts: 624
Loc: London, England
Hi Everyone

I have created this script that I know works, but for my own benifit I just wanted to know if I have scripted it the best way, or if there would have been a better way to do it.

Thanks

Richard Farthing

code:
 
break on
shell "net use m: /delete"
shell "net use m: \\192.168.137.220\c$ /user:netadmin ******"
if open (3, "m:\Program Files\VERITAS\Backup Exec\NT\Data\Bex00.txt") = 0
$LINE1 = ReadLine(3)+@CRLF
$LINE2= ReadLine(3)+@CRLF
$LINE3= ReadLine(3)+@CRLF
$LINE4= ReadLine(3)+@CRLF
$LINE5= ReadLine(3)+@CRLF
$LINE6= ReadLine(3)+@CRLF
$LINE7= ReadLine(3)+@CRLF
$LINE8= ReadLine(3)+@CRLF
$LINE9= ReadLine(3)+@CRLF
$LINE10= ReadLine(3)+@CRLF
$LINE11= ReadLine(3)+@CRLF
$LINE12= ReadLine(3)+@CRLF
$LINE13= ReadLine(3)+@CRLF
$LINE14= ReadLine(3)+@CRLF
$LINE15= ReadLine(3)+@CRLF
$LINE16= ReadLine(3)+@CRLF
$LINE17= ReadLine(3)+@CRLF
$LINE18= ReadLine(3)+@CRLF
$LINE19= ReadLine(3)+@CRLF
$LINE20= ReadLine(3)+@CRLF
$LINE21= ReadLine(3)+@CRLF
$LINE22= ReadLine(3)+@CRLF
$LINE23= ReadLine(3)+@CRLF
$LINE24= ReadLine(3)+@CRLF
$LINE25= ReadLine(3)+@CRLF
$LINE26= ReadLine(3)+@CRLF
$LINE27= ReadLine(3)+@CRLF
$LINE28= ReadLine(3)+@CRLF
$LINE29= ReadLine(3)+@CRLF
$LINE30= ReadLine(3)+@CRLF
$LINE31= ReadLine(3)+@CRLF
$LINE32= ReadLine(3)+@CRLF
$LINE33= ReadLine(3)+@CRLF
$LINE34= ReadLine(3)+@CRLF
$LINE35= ReadLine(3)+@CRLF
$LINE36= ReadLine(3)+@CRLF
$LINE37= ReadLine(3)+@CRLF
$LINE38= ReadLine(3)+@CRLF
$LINE39= ReadLine(3)+@CRLF
$LINE40= ReadLine(3)+@CRLF
$LINE41= ReadLine(3)+@CRLF
$LINE42= ReadLine(3)+@CRLF
$LINE43= ReadLine(3)+@CRLF
$LINE44= ReadLine(3)+@CRLF
$LINE45= ReadLine(3)+@CRLF
$LINE46= ReadLine(3)+@CRLF
$LINE47= ReadLine(3)+@CRLF
$LINE48= ReadLine(3)+@CRLF
$LINE49= ReadLine(3)+@CRLF
$LINE50= ReadLine(3)+@CRLF
$LINE51= ReadLine(3)+@CRLF
$LINE52 = ReadLine(3)+@CRLF
$LINE53= ReadLine(3)+@CRLF
$LINE54= ReadLine(3)+@CRLF
$LINE55= ReadLine(3)+@CRLF
$LINE56= ReadLine(3)+@CRLF
$LINE57= ReadLine(3)+@CRLF
$LINE58= ReadLine(3)+@CRLF
$LINE59= ReadLine(3)+@CRLF
$LINE60= ReadLine(3)+@CRLF
$LINE61= ReadLine(3)+@CRLF
$LINE62= ReadLine(3)+@CRLF
$LINE63= ReadLine(3)+@CRLF
$LINE64= ReadLine(3)+@CRLF
$LINE65= ReadLine(3)+@CRLF
$LINE66= ReadLine(3)+@CRLF
$LINE67= ReadLine(3)+@CRLF
$LINE68= ReadLine(3)+@CRLF
$LINE69= ReadLine(3)+@CRLF
$LINE70= ReadLine(3)+@CRLF
$LINE71= ReadLine(3)+@CRLF
$LINE72= ReadLine(3)+@CRLF
$LINE73= ReadLine(3)+@CRLF
$LINE74= ReadLine(3)+@CRLF
$LINE75= ReadLine(3)+@CRLF
$LINE76= ReadLine(3)+@CRLF
$LINE77= ReadLine(3)+@CRLF
$LINE78= ReadLine(3)+@CRLF
$LINE79= ReadLine(3)+@CRLF
$LINE80= ReadLine(3)+@CRLF
$LINE81= ReadLine(3)+@CRLF
$LINE82= ReadLine(3)+@CRLF
$LINE83= ReadLine(3)+@CRLF
$LINE84= ReadLine(3)+@CRLF
$LINE85= ReadLine(3)+@CRLF
$LINE86= ReadLine(3)+@CRLF
$LINE87= ReadLine(3)+@CRLF
$LINE88= ReadLine(3)+@CRLF
$LINE89= ReadLine(3)+@CRLF
$LINE90= ReadLine(3)+@CRLF
$LINE91= ReadLine(3)+@CRLF
$LINE92= ReadLine(3)+@CRLF
$LINE93= ReadLine(3)+@CRLF
$LINE94= ReadLine(3)+@CRLF
$LINE95= ReadLine(3)+@CRLF
$LINE96= ReadLine(3)+@CRLF
$LINE97= ReadLine(3)+@CRLF
$LINE98= ReadLine(3)+@CRLF
$LINE99= ReadLine(3)+@CRLF
$LINE100= ReadLine(3)+@CRLF
$LINE101= ReadLine(3)+@CRLF
$LINE102= ReadLine(3)+@CRLF
$LINE103= ReadLine(3)+@CRLF
$LINE104= ReadLine(3)+@CRLF
$LINE105= ReadLine(3)+@CRLF
$LINE106= ReadLine(3)+@CRLF
$LINE107= ReadLine(3)+@CRLF
$LINE108= ReadLine(3)+@CRLF
$LINE109= ReadLine(3)+@CRLF
$LINE110= ReadLine(3)+@CRLF
$LINE111= ReadLine(3)+@CRLF
$LINE112= ReadLine(3)+@CRLF
$LINE113= ReadLine(3)+@CRLF
$LINE114= ReadLine(3)+@CRLF
$LINE115= ReadLine(3)+@CRLF
$LINE116= ReadLine(3)+@CRLF
$LINE117= ReadLine(3)+@CRLF
$LINE118= ReadLine(3)+@CRLF
$LINE119= ReadLine(3)+@CRLF
$LINE120= ReadLine(3)+@CRLF
$LINE121= ReadLine(3)+@CRLF
$LINE122= ReadLine(3)+@CRLF
$LINE123= ReadLine(3)+@CRLF
$LINE124= ReadLine(3)+@CRLF
$LINE125= ReadLine(3)+@CRLF
$LINE126= ReadLine(3)+@CRLF
$LINE127= ReadLine(3)+@CRLF
$LINE128= ReadLine(3)+@CRLF
$LINE129= ReadLine(3)+@CRLF
$LINE130= ReadLine(3)+@CRLF
$LINE131= ReadLine(3)+@CRLF
$LINE132= ReadLine(3)+@CRLF


If Left($Line100,11)="Job Ended: "
$JobEnded=SubStr($Line100,12)
EndIf
If Left($Line101,11)="Job Ended: "
$JobEnded=SubStr($Line101,12)
EndIf
If Left($Line102,11)="Job Ended: "
$JobEnded=SubStr($Line102,12)
EndIf
If Left($Line103,11)="Job Ended: "
$JobEnded=SubStr($Line103,12)
EndIf
If Left($Line104,11)="Job Ended: "
$JobEnded=SubStr($Line104,12)
EndIf
If Left($Line105,11)="Job Ended: "
$JobEnded=SubStr($Line105,12)
EndIf
If Left($Line106,11)="Job Ended: "
$JobEnded=SubStr($Line106,12)
EndIf
If Left($Line107,11)="Job Ended: "
$JobEnded=SubStr($Line107,12)
EndIf
If Left($Line108,11)="Job Ended: "
$JobEnded=SubStr($Line108,12)
EndIf
If Left($Line109,11)="Job Ended: "
$JobEnded=SubStr($Line109,12)
EndIf
If Left($Line110,11)="Job Ended: "
$JobEnded=SubStr($Line110,12)
EndIf
If Left($Line111,11)="Job Ended: "
$JobEnded=SubStr($Line111,12)
EndIf
If Left($Line112,11)="Job Ended: "
$JobEnded=SubStr($Line112,12)
EndIf
If Left($Line113,11)="Job Ended: "
$JobEnded=SubStr($Line113,12)
EndIf
If Left($Line114,11)="Job Ended: "
$JobEnded=SubStr($Line114,12)
EndIf
If Left($Line115,11)="Job Ended: "
$JobEnded=SubStr($Line115,12)
EndIf
If Left($Line116,11)="Job Ended: "
$JobEnded=SubStr($Line116,12)
EndIf
If Left($Line117,11)="Job Ended: "
$JobEnded=SubStr($Line117,12)
EndIf
If Left($Line118,11)="Job Ended: "
$JobEnded=SubStr($Line118,12)
EndIf
If Left($Line119,11)="Job Ended: "
$JobEnded=SubStr($Line119,12)
EndIf
If Left($Line120,11)="Job Ended: "
$JobEnded=SubStr($Line120,12)
EndIf
If Left($Line121,11)="Job Ended: "
$JobEnded=SubStr($Line121,12)
EndIf
If Left($Line122,11)="Job Ended: "
$JobEnded=SubStr($Line122,12)
EndIf
If Left($Line123,11)="Job Ended: "
$JobEnded=SubStr($Line123,12)
EndIf
If Left($Line124,11)="Job Ended: "
$JobEnded=SubStr($Line124,12)
EndIf
If Left($Line125,11)="Job Ended: "
$JobEnded=SubStr($Line125,12)
EndIf
If Left($Line126,11)="Job Ended: "
$JobEnded=SubStr($Line126,12)
EndIf
If Left($Line127,11)="Job Ended: "
$JobEnded=SubStr($Line127,12)
EndIf
If Left($Line128,11)="Job Ended: "
$JobEnded=SubStr($Line128,12)
EndIf
If Left($Line129,11)="Job Ended: "
$JobEnded=SubStr($Line129,12)
EndIf
If Left($Line130,11)="Job Ended: "
$JobEnded=SubStr($Line130,12)
EndIf
If Left($Line131,11)="Job Ended: "
$JobEnded=SubStr($Line131,12)
EndIf
If Left($Line132,11)="Job Ended: "
$JobEnded=SubStr($Line132,12)
EndIf


If Left($Line100,23)="Job completion status: "
$JobStatus=SubStr($Line100,24)
EndIf
If Left($Line101,23)="Job completion status: "
$JobStatus=SubStr($Line101,24)
EndIf
If Left($Line102,23)="Job completion status: "
$JobStatus=SubStr($Line102,24)
EndIf
If Left($Line103,23)="Job completion status: "
$JobStatus=SubStr($Line103,24)
EndIf
If Left($Line104,23)="Job completion status: "
$JobStatus=SubStr($Line104,24)
EndIf
If Left($Line105,23)="Job completion status: "
$JobStatus=SubStr($Line105,24)
EndIf
If Left($Line106,23)="Job completion status: "
$JobStatus=SubStr($Line106,24)
EndIf
If Left($Line107,23)="Job completion status: "
$JobStatus=SubStr($Line107,24)
EndIf
If Left($Line108,23)="Job completion status: "
$JobStatus=SubStr($Line108,24)
EndIf
If Left($Line109,23)="Job completion status: "
$JobStatus=SubStr($Line109,24)
EndIf
If Left($Line110,23)="Job completion status: "
$JobStatus=SubStr($Line110,24)
EndIf
If Left($Line111,23)="Job completion status: "
$JobStatus=SubStr($Line111,24)
EndIf
If Left($Line112,23)="Job completion status: "
$JobStatus=SubStr($Line112,24)
EndIf
If Left($Line113,23)="Job completion status: "
$JobStatus=SubStr($Line113,24)
EndIf
If Left($Line114,23)="Job completion status: "
$JobStatus=SubStr($Line114,24)
EndIf
If Left($Line115,23)="Job completion status: "
$JobStatus=SubStr($Line115,24)
EndIf
If Left($Line116,23)="Job completion status: "
$JobStatus=SubStr($Line116,24)
EndIf
If Left($Line117,23)="Job completion status: "
$JobStatus=SubStr($Line117,24)
EndIf
If Left($Line118,23)="Job completion status: "
$JobStatus=SubStr($Line118,24)
EndIf
If Left($Line119,23)="Job completion status: "
$JobStatus=SubStr($Line119,24)
EndIf
If Left($Line120,23)="Job completion status: "
$JobStatus=SubStr($Line120,24)
EndIf
If Left($Line121,23)="Job completion status: "
$JobStatus=SubStr($Line121,24)
EndIf
If Left($Line122,23)="Job completion status: "
$JobStatus=SubStr($Line122,24)
EndIf
If Left($Line123,23)="Job completion status: "
$JobStatus=SubStr($Line123,24)
EndIf
If Left($Line124,23)="Job completion status: "
$JobStatus=SubStr($Line124,24)
EndIf
If Left($Line125,23)="Job completion status: "
$JobStatus=SubStr($Line125,24)
EndIf
If Left($Line126,23)="Job completion status: "
$JobStatus=SubStr($Line126,24)
EndIf
If Left($Line127,23)="Job completion status: "
$JobStatus=SubStr($Line127,24)
EndIf
If Left($Line128,23)="Job completion status: "
$JobStatus=SubStr($Line128,24)
EndIf
If Left($Line129,23)="Job completion status: "
$JobStatus=SubStr($Line129,24)
EndIf
If Left($Line130,23)="Job completion status: "
$JobStatus=SubStr($Line130,24)
EndIf
If Left($Line131,23)="Job completion status: "
$JobStatus=SubStr($Line131,24)
EndIf
If Left($Line132,23)="Job completion status: "
$JobStatus=SubStr($Line132,24)
EndIf


If redirectoutput("\\fps\admin\AdminLogs\Backup.log") = 0 ; to a file
?"*****************************************************"
?""
"$line2"?
"$line3"?
"$line4"?
"$line5"?
"Job Status: $JobEnded"?
"Job completion status: $JobStatus"?
?"*****************************************************"
?""
Endif
If redirectoutput("") = 0 ; back to the console
Endif

close (3)
else
endif

del "m:\Program Files\VERITAS\Backup Exec\NT\Data\Bex00.txt"



Top
#34801 - 2003-01-06 05:04 PM Re: Backup Log Files Script
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
I would rather loop through the log file instead of hardcoding the lines.

See also Readline problem
_________________________
There are two types of vessels, submarines and targets.

Top
#34802 - 2003-01-06 05:06 PM Re: Backup Log Files Script
Richie19Rich77 Offline
Seasoned Scripter
*****

Registered: 2002-08-16
Posts: 624
Loc: London, England
Sorry I should have explained what I am doing with the script.

I am trying to get rid of all the crap that is displayed in a backup log file and keep the outcome very basic, and log it to a central Backup Log for all servers.

Now the log file is very long, so I has to read in 132 lines, then because the Completed line could be on different lines depending on the open files, I had to do a search on lines 100 to 130.

Then it redirects the output to a file.

Hope that explains it.

Thanks

Richard Farthing

Top
#34803 - 2003-01-06 05:08 PM Re: Backup Log Files Script
Richie19Rich77 Offline
Seasoned Scripter
*****

Registered: 2002-08-16
Posts: 624
Loc: London, England
Good Thinking, I could do a loop statement and +1 to the readline command.

Thanks

Richard

Top
#34804 - 2003-01-06 05:08 PM Re: Backup Log Files Script
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
However, you can still use a loop to read the lines.
code:
$linenumber=0
while $linenumber<123
$rc=readline(1)
$linenumber=$linenumber+1
loop
; do the other stuff

_________________________
There are two types of vessels, submarines and targets.

Top
#34805 - 2003-01-06 05:23 PM Re: Backup Log Files Script
h00kupz Offline
Fresh Scripter

Registered: 2002-07-17
Posts: 14
Loc: Atlanta
Hi Richard,
I am right in the middle of writing a backup log processing script. Currently my script reads the Job name, Mesia label, Media set, Completion status, Average throughput, into a csv file that you can manipulate in excel. I'm only having trouble adding up total bytes backed up due to the long integer problem. If you would Like send me an email and I can send you my scripts that have instantly becomve very beneficial. No more scanning of individual jobs to find out what tapes you need to pull. No more scanning of logs to determine how large your backup sets are etc. Right now everything works but the total job size. Let me know! (FYI The code is a little sloppy right now because I've been working on pure functionality but I'll be glad to send what I have ... ).
_________________________
Select * from users where clue > 0 [b]0 rows affected.[/b]

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 484 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.053 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org