|
LLigetfa,
That code worked like a charm!
I modified it a bit.. but I wanted to ask you. We want to use the counting feature that you wrote to basically count lines of dir.txt and if there are more than ten lines, to run a script that would output the text into an email.
Also, if there less than 10, but more than zero to run a different script that would output the text into an email?
Would that be nested if then statements?
Ultimately what we want to do, and maybe others can offer some suggestions, is that if the result is greater than zero, but less than 10 (this by the way represents number of sites that did not backup across the WAN if you are curious) to email an account here and we'll take care of it in the morning.
If its greater than 10, then we need design a paging script that will take the output file from above (10+ sites) attach the plain text to email, send it, and then wait for a response (how it will do that I don't know, but my boss does it with SCO unix box)
If it doesn't get a response from the first person on the list, it tries the next etc.. until someone shoots back a message that stops the paging sequence and takes care of the problem..
Here is my modifed version:
Break on $count = 0 $FileName = "C:\branches\dir.txt" $ResultFile = "C:\branches\Result.txt" IF Open(1, $FileName) = 0 $x = ReadLine(1) WHILE @ERROR = 0 $count = $count + 1 $x = ReadLine(1) LOOP ENDIF IF Open(2, $ResultFile,5) = 0 $x = WriteLine( 2 , "Log " + $FileName + " reports " +
$count + " down sites" + Chr(13) + Chr(10) ) ELSE BEEP ? "failed to open file, error code : [" + @ERROR + "]" ENDIF ;get $ QUIT
Anyone have any suggestions.. I know this is rather complex.. Even a software package that exists will suffice..
|