Login | |
|
 |
RE: Script Mysteriously Quits - 3/10/2008 10:04:36 PM
|
|
 |
|
| |
TomRiddle
Posts: 188
Score: 4
Joined: 2/7/2008
Status: offline
|
Hi ginolard, Nope, that is not it :) I am thinking of rewriting it from scratch and doing a few things a lot better, which will probably fix it but it supposed to be just a quick knock up script for a job. Thought I would throw it out there and spend a little more time debugging first, though I cant see any evidence of a bug except the fact that it stops logging after iteration 1721. That is a 45kb file and ~30mins run time.
|
|
| |
|
|
|
 |
RE: Script Mysteriously Quits - 3/10/2008 10:21:32 PM
|
|
 |
|
| |
TomRiddle
Posts: 188
Score: 4
Joined: 2/7/2008
Status: offline
|
Out of memory on this line:- sTempFile = objFSO.GetSpecialFolder(2).ShortPath & "\" & objFSO.GetTempName I can sort that, thanks anyway.
|
|
| |
|
|
|
 |
RE: Script Mysteriously Quits - 3/11/2008 10:05:22 AM
|
|
 |
|
| |
TomRiddle
Posts: 188
Score: 4
Joined: 2/7/2008
Status: offline
|
OK it is still officially a mystery. It does 1720 iterations and bombs out C:\Documents and Settings\user\Desktop\PingLogger.vbs(92, 1) Microsoft VBScript runtime error: Out of memory: 'objFSO.FileExists' Can anyone give me any hints as to what I am doing wrong?
|
|
| |
|
|
|
 |
RE: Script Mysteriously Quits - 3/11/2008 11:11:57 AM
|
|
 |
|
| |
TNO
Posts: 1247
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
Put Option Explicit at the top of the script. You have at least 2 undefined variables. This may plug your memory leak.
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
 |
RE: Script Mysteriously Quits - 3/11/2008 10:49:14 PM
|
|
 |
|
| |
TomRiddle
Posts: 188
Score: 4
Joined: 2/7/2008
Status: offline
|
Thanks for your help Guys, That's some really good advice, I guess all those bugs really shows that I threw it together, oh well... it sort of works, except for this memory bug that I have never come across. the most infuriating thing about it is that I have to run it for 30 mins before the bug happens. I tried the option explicit (it was not that) I fixed up the scriptpath variable (it was not that) I got rid of the objFSO that I had already defined at the global level (it was not that) I replaced the WriteLogFile sub with the elegant one that you wrote dm_4ever (it was not that) I still get a memory error, but now :- C:\Documents and Settings\user\Desktop\PingLogger.vbs(101, 3) Microsoft VBScript runtime error: Out of memory: 'objFSO.OpenTextFile' I'd rather not have to change the ping to WMI version in case I want to ping a router, but it is an excellent idea that I will try tomorrow. And thanks dm for the other excellent idea of using scheduled tasks to do a periodic check. That definitely will get around this problem but it has now got to the stage where I need to work out why it is bombing out, for my own sanity, there is nothing special about this script. I have updated the first post with my latest version of this script, which still bombs out.
|
|
| |
|
|
|
 |
RE: Script Mysteriously Quits - 3/11/2008 11:21:34 PM
|
|
 |
|
| |
Rischip
Posts: 502
Score: 2
Joined: 3/26/2007
Status: offline
|
The Function PingResult(strHost) is doing an endless recursion and never exiting. Remove the line[ PingResult strHost ] from the bottom of the Function and put it in a loop in the mainline routine.
_____________________________
Rischip Author of - The Grim Linker
|
|
| |
|
|
|
 |
RE: Script Mysteriously Quits - 3/12/2008 1:00:58 AM
|
|
 |
|
| |
dm_4ever
Posts: 2641
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
|
Just an FYI, pinging via WMI only require WMI on the machine you're pinging FROM and not the machine you're actually pinging...so a router should be no issue.
_____________________________
dm_4ever My philosophy: K.I.S.S - Keep It Simple Stupid Read Me: http://www.visualbasicscript.com/m_24727/tm.htm Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Script Mysteriously Quits - 3/12/2008 1:17:25 PM
|
|
 |
|
| |
TomRiddle
Posts: 188
Score: 4
Joined: 2/7/2008
Status: offline
|
Thanks Rischip, You fixed it. and Thanks dm_forever, I won't update this script with the WMI ping code but will work out how to use that in future scripts like this. I have one in particular that I am working on that reads the output of a ping and returns an IP. I used ping.exe because I thought WMI would not return the ip from a device which does not have WMI installed. Maybe WMI ping does. I updated the original post with the fixed version.
|
|
| |
|
|
|
 |
RE: Script Mysteriously Quits - 3/16/2008 10:54:17 PM
|
|
 |
|
| |
Rischip
Posts: 502
Score: 2
Joined: 3/26/2007
Status: offline
|
You're welcome. Very easy mistake to make. One I'm sure you won't make again. Always remember with recursion you need a control to somehow verify that the loop is not infinite.
_____________________________
Rischip Author of - The Grim Linker
|
|
| |
|
|
|
|
|