WikiView Posted October 12, 2006 Posted October 12, 2006 im a admin at a open learning center and we are in desperate need for a program that pings a server and if the netcable are disconnected it had to reboot. my problem is that if i do a _RunDOS($ping xxx.xx.xx.xx) can i get a return value, if it cant ping it ? or is there a smarter method? i was thinking about something like this sleep(50000) ;gives the user 50 sec to start up while(1) _runDOS($ping xxx.xxx.xx.xx) if RETURNVALUEHERE = 1 then shutdown(5) else sleep(10000) WEnd is it possible? thx in advance
creeping Posted October 12, 2006 Posted October 12, 2006 (edited) I guess the smarter method would be to use the ping function found in the help file $var = Ping("www.AutoItScript.com",250) If $var Then; also possible: If @error = 0 Then ... Msgbox(0,"Status","Online, roundtrip was:" & $var) Else Msgbox(0,"Status","An error occured with number: " & @error) EndIf Edited October 12, 2006 by creeping
WikiView Posted October 12, 2006 Author Posted October 12, 2006 I guess the smarter method would be to use the ping function found in the help file $var = Ping("www.AutoItScript.com",250) If $var Then; also possible: If @error = 0 Then ... Msgbox(0,"Status","Online, roundtrip was:" & $var) Else Msgbox(0,"Status","An error occured with number: " & @error) EndIf doh my bad, thx mate
sulfurious Posted October 12, 2006 Posted October 12, 2006 You could also make a batch file like this, where -n is the # of packets to ping with, and -t is the # of seconds till reboot. ping 192.168.1.1 -n 1 | find "TTL">nul if errorlevel 1 shutdown -r -t 10 Sul
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