[mrtg] Re: Trying to log ConfigMaker output

William Owen william.owen at profilesmail.com
Mon Nov 28 22:08:08 MET 2005


I don't run cfgmaker systematically but I have run several other utilities
that have the same issue.  I recommend using VBScript to run the script,
capture the STDOUT and STDERR and take action (such as notify you) based on
the results.



Function Run (ByVal cmd)
    Dim sh
    Dim wsx

    Set sh = CreateObject("WScript.Shell")
    Set wsx = Sh.Exec(cmd)

    If wsx.ProcessID = 0 And wsx.Status = 1 Then
        ' (The Win98 version of VBScript does not detect WshShell.Exec
errors)
        Err.Raise vbObjectError,,"WshShell.Exec failed."
        End If
    Do
        Dim Status
        Status = wsx.Status
        WScript.StdOut.Write wsx.StdOut.ReadAll()
        WScript.StdErr.Write wsx.StdErr.ReadAll()
        If Status <> 0 Then Exit Do
        WScript.Sleep 10
    Loop
    Run = wsx.ExitCode
End Function

-----Original Message-----
From: Steve Shipway [mailto:s.shipway at auckland.ac.nz] 
Sent: Monday, November 28, 2005 2:17 PM
To: 'Kriegel, Kerry L.'; mrtg at list.ee.ethz.ch
Subject: [mrtg] Re: Trying to log ConfigMaker output

>I have tried to implement my cfgmaker command line with a 
>redirect to a log file so that I can have somewhere to see if 
>ConfigMaker had any problems. 
...
>It is interesting to note that each allows configmaker to run 
>successfully and display output in the DOS window, but none of 
>them redirect the output to the log.txt file.  Any ideas?

The cfgmaker script sends the progress output on STDERR, file descriptor 2.
In order to redirect this to a logfile, you need to redirect this and not
STDOUT (file descriptor 1, the default).  Hence, if you just use the normal
redirect, it wont catch this output.

Under UNIX, you would use:

cfgmake foo 2>>/tmp/logfile

to redirect stderr, but I don't know what syntax the DOS world uses.

Steve

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://lists.ee.ethz.ch/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://lists.ee.ethz.ch/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the mrtg mailing list