Roofel Posted May 11, 2008 Posted May 11, 2008 Hello:) I got this problem with my internet connection and I want to keep a log of this everytime it stops working... I am not sure on how it can be detected by a script but i know it is some way... I only need the script to run in the background then write the Date and Time of the timeout in log file or a text file... I can find out the rest of the script when I get a clue on how to detect the timeout... Hopefully you will be able to help me with this:) Never argue with an idiot, he will just bring you down to his own level and beat you with experience! :D
Roofel Posted May 11, 2008 Author Posted May 11, 2008 WMI?.... Got any code example on how I might get it done? Never argue with an idiot, he will just bring you down to his own level and beat you with experience! :D
amokoura Posted May 11, 2008 Posted May 11, 2008 Google for WMI and you know what it is. Then search here how people have used it. I'm not sure if it's good for internet connection monitoring but give it a try.
Roofel Posted May 11, 2008 Author Posted May 11, 2008 I couldnt find anything on if it can run constantly in the background and make a log entry on this:S From what i have seen you got to have the "program" up at all times... Never argue with an idiot, he will just bring you down to his own level and beat you with experience! :D
theguy0000 Posted May 11, 2008 Posted May 11, 2008 (edited) you could put Ping("www.google.com") in an infinite loop, and if it fails then write to a log. edit: well the program does have to be running all the time, but it's still in the background. You don't actually see anything unless you create a GUI, if that's what you're worried about. Edited May 11, 2008 by theguy0000 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
herewasplato Posted May 11, 2008 Posted May 11, 2008 expandcollapse popup$file = FileOpen("log.txt", 1) ; Check if file opened for writing OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWriteLine($file, "Monitoring started " & _ @MDAY & _ "-" & _ @MON & _ "-" & _ @YEAR & _ "---" & _ @HOUR & _ ":" & _ @MIN & _ ":" & _ @SEC) While 1 Select Case Ping("oneringnetworks.com") > 0 Case Ping("chromium.nti.us") > 0 Case Ping("srv01-bzn1.snsci.net") > 0 Case Ping("[url="http://www.google.com"]www.google.com[/url]") > 0 Case Ping("games.internode.on.net") > 0 Case Else FileWriteLine($file, "Down? " & _ @MDAY & _ "-" & _ @MON & _ "-" & _ @YEAR & _ "---" & _ @HOUR & _ ":" & _ @MIN & _ ":" & _ @SEC) EndSelect Sleep(1000) WEnd Func OnAutoItExit() FileWriteLine($file, "Monitoring ended " & _ @MDAY & _ "-" & _ @MON & _ "-" & _ @YEAR & _ "---" & _ @HOUR & _ ":" & _ @MIN & _ ":" & _ @SEC) EndFunc ;==>OnAutoItExitlog file:Monitoring started 11-05-2008---12:00:16 Down? 11-05-2008---12:00:53 Down? 11-05-2008---12:01:14 Monitoring ended 11-05-2008---12:03:04you can make it prettier [size="1"][font="Arial"].[u].[/u][/font][/size]
Roofel Posted May 11, 2008 Author Posted May 11, 2008 Not worried about seeing it no:) Just worried about the memory usage:P It will contain a small amount of memory constantly right? Never argue with an idiot, he will just bring you down to his own level and beat you with experience! :D
theguy0000 Posted May 11, 2008 Posted May 11, 2008 Not worried about seeing it no:) Just worried about the memory usage:P It will contain a small amount of memory constantly right?sure as long as you set the sleep command to a high number. I have it at 5 seconds, you may want to make it longer. I'd say 60 seconds should be fine. The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN
Roofel Posted May 11, 2008 Author Posted May 11, 2008 Hehe, thanks:) The reason I needed help with it was because our internet provider is kinda unstable from time to time. I was supposed to write a "log" on paper each time it went down but from time to time I cant do this since im not here:P Never argue with an idiot, he will just bring you down to his own level and beat you with experience! :D
herewasplato Posted May 11, 2008 Posted May 11, 2008 Not worried about seeing it no:) Just worried about the memory usage:P It will contain a small amount of memory constantly right? 5MB or so... with another 2MB or Virtual RAM [size="1"][font="Arial"].[u].[/u][/font][/size]
Roofel Posted May 11, 2008 Author Posted May 11, 2008 When i put the sleep timer on 35 seconds it stands on 400-410K in Memory usage:P not much at allxD Now i just have to wait to check if it picks up my time outs:P Never argue with an idiot, he will just bring you down to his own level and beat you with experience! :D
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now