Sign in to follow this  
Followers 0
WikiView

ping or reboot

4 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by creeping

Share this post


Link to post
Share on other sites

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 :lmao:

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0