Page 1 of 1 1
Topic Options
#162255 - 2006-05-23 01:29 PM check serverstatus
Gilrim Offline
Fresh Scripter

Registered: 2005-07-19
Posts: 20
I'm writing a loginscript, and upon loading network shares I'd like to check if the server's online. I'm now doing this usin ping, but if a server is missing dns-records it takes ~8 secounds to time-out.
This quicky would leave the script "hanging" - so, long story short: is there a better way?

also, I'm capturing the ping output thru wshPipe, that opens a console window. Are there any way of doing this without opening a terminal window, or hiding it?

Top
#162256 - 2006-05-23 02:15 PM Re: check serverstatus
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
You could use the ping udf instead of wshpipe.
We used it in combination with kixforms and change some text and icons depending on ping success or failure.

Ping() - checks for reply , or returns ip-address of remote host
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#162257 - 2006-05-23 02:17 PM Re: check serverstatus
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Why are your servers DNS records missing?
Top
#162258 - 2006-05-23 02:21 PM Re: check serverstatus
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Code:
shell "ping -n 1 "+$Server+" | find /i 'TTL' >Nul"
If not @error ? "Server Responded" Else ? "Server did not respond" EndIf


This will still take 2 seconds to time out, but you can change that in the Shell command as well with the -i switch.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#162259 - 2006-05-23 02:23 PM Re: check serverstatus
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Quote:

Why are your servers DNS records missing?



Better question is why is the server down and why would it take a logon script to notice?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#162260 - 2006-05-23 02:23 PM Re: check serverstatus
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Allthough I find it nice that you trust my udf, It doesn't really say anything about the server state; It just checks if the NIC of the server is willing/able to reply to a ping request
_________________________



Top
#162261 - 2006-05-23 02:24 PM Re: check serverstatus
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Quote:

Why are your servers DNS records missing?




Good one.
You should fix the source of the problem and not the result.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#162262 - 2006-05-23 02:28 PM Re: check serverstatus
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Quote:

Allthough I find it nice that you trust my udf, It doesn't really say anything about the server state; It just checks if the NIC of the server is willing/able to reply to a ping request




You are right.
It will not say anything about running services and stuff like that. It only gives a indication if the system is switched on and can be reached over the network.

My reply was about the use of wshpipe to get the ping results back to the script.


Edited by Mart (2006-05-23 02:29 PM)

Top
#162263 - 2006-05-23 02:38 PM Re: check serverstatus
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Garg,

your posted code should be more like this :

Code:

shell "ping -n 1 "+$Server+" | find /i 'TTL' >Nul"
If not @error
? "Server Responded or Network Hardware found the Server to be unreachable and responded TTL expired in Transit"
Else
? "Server did not respond"
EndIf
Code:


The only valid find string is TTL=, fullstop.
_________________________



Top
#162264 - 2006-05-23 05:13 PM Re: check serverstatus
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Quote:

The only valid find string is TTL=, fullstop.





If you are looking only for a "Postive" response, I have recently done a script (see this post) where I am looking for other responses.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#162265 - 2006-05-23 06:15 PM Re: check serverstatus
Gilrim Offline
Fresh Scripter

Registered: 2005-07-19
Posts: 20
the records aren't missing, and the servers are online - but I'd like the script to "be prepared", if they should for some reason go down.

if a server doesn't resond to a ping, it's pretty fair to say that that server arent usable for any file shares Thus, there arent any reason to even attempt to connect to the remaining shares on that server...

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.072 seconds in which 0.037 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org