Page 1 of 1 1
Topic Options
#30604 - 2002-10-11 11:15 PM @error
brewdude6 Offline
Hey THIS is FUN

Registered: 2000-10-21
Posts: 280
Loc: Nashville, TN
This section of my script doesn't seem to be working correctly. It will continue on to the "start" section if the network is present or not. Any advice?

code:
shell '%comspec% /c ping -w 5000 -n 1 hrbackup | find /i "ttl"'
if @ERROR=0
goto start
else
goto end
endif

_________________________
I could have made a neat retort but didn't, for I was flurried and didn't think of it till I was downstairs.
-Mark Twain

Top
#30605 - 2002-10-11 11:20 PM Re: @error
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
heh...
check the errorlevel from the commandprompt.
pass the same line on commandline.
then do:
echo %errorlevel%

anyway, on my w2k, I can see no /w switch
_________________________
!

download KiXnet

Top
#30606 - 2002-10-11 11:26 PM Re: @error
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
On my Windows 2000 Workstation I can see a -w switch [Wink]
_________________________
There are two types of vessels, submarines and targets.

Top
#30607 - 2002-10-11 11:33 PM Re: @error
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yeah, that is the problem of trying to do multiple things at the same time...
_________________________
!

download KiXnet

Top
#30608 - 2002-10-11 11:39 PM Re: @error
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Yeah, you might need to put that beer down for a minute!
_________________________
There are two types of vessels, submarines and targets.

Top
#30609 - 2002-10-11 11:41 PM Re: @error
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
[Confused]

as told before, no beer tonight.
_________________________
!

download KiXnet

Top
#30610 - 2002-10-11 11:43 PM Re: @error
brewdude6 Offline
Hey THIS is FUN

Registered: 2000-10-21
Posts: 280
Loc: Nashville, TN
Just as I suspected. When I echo errorlevel I get errorlevel=0 when network cable plugged in and errorlevel=1 when unplugged.

Is there something wrong with my syntax?
_________________________
I could have made a neat retort but didn't, for I was flurried and didn't think of it till I was downstairs.
-Mark Twain

Top
#30611 - 2002-10-11 11:46 PM Re: @error
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
what I can say, it looks ok.
take the wait parameter of and check if it still fails.
_________________________
!

download KiXnet

Top
#30612 - 2002-10-11 11:46 PM Re: @error
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
What did you expect?

If the PING to HRBACKUP is successful, the script jumpt to START, otherwise it goes to END. So, if you pull the network cable, it is most likely that the ping will fail and therefore the script goes to END.
_________________________
There are two types of vessels, submarines and targets.

Top
#30613 - 2002-10-11 11:48 PM Re: @error
brewdude6 Offline
Hey THIS is FUN

Registered: 2000-10-21
Posts: 280
Loc: Nashville, TN
Well, I just tested on a Win2k machine and it works. I will do more testing and Win9x and report.
_________________________
I could have made a neat retort but didn't, for I was flurried and didn't think of it till I was downstairs.
-Mark Twain

Top
#30614 - 2002-10-11 11:53 PM Re: @error
brewdude6 Offline
Hey THIS is FUN

Registered: 2000-10-21
Posts: 280
Loc: Nashville, TN
That is Exactly what I expected it to do but it didn't.
_________________________
I could have made a neat retort but didn't, for I was flurried and didn't think of it till I was downstairs.
-Mark Twain

Top
#30615 - 2002-10-12 12:41 AM Re: @error
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
brewdude6,

Doesn't this work for you?

code:
 break on
cls
:start
SLEEP 3
?"pinging server hrbackup"
SHELL '%comspec% /c ping -w 5000 -n 1 hrbackup | find /i "ttl" > nul'
IF @error = 0
GOTO start
ELSE
GOTO end
ENDIF

:end
?"Server not found"
SLEEP 3
EXIT



[ 12. October 2002, 00:41: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

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 302 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.088 seconds in which 0.05 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