Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
shutdown server in an order
Name: nuganen Date: November 4, 2007 at 17:39:20 Pacific OS: winxp pro CPU/Ram: 1gb Product: hp
Comment:
Hi,
I'm trying to write a batch file that shutdown servers in a sequential order however having an issue at the moment think it has to do with the ping command
this is what i have so far
@echo on
REM -s is shutdown REM -m is pc REM -t is time REM -c is comments
REM shutdown server from a list FOR /F %%A IN (server.txt) DO (
shutdown -s -m \\%%A -t 120
call :keeppingingdamnyou
) GoTo :EOF
:keeppingingdamnyou ping -n 1 %%A|find /i "TTL=" >NUL if %errorlevel%==1 goto keeppingingdamnyou net send user "%%A is down!"
Name: nuganen Date: November 4, 2007 at 18:48:22 Pacific
Reply:
the %errorlevel%=0 not 1 it was a typo
0
Response Number 2
Name: Razor2.3 Date: November 4, 2007 at 19:15:24 Pacific
Reply:
Q: Aside from a needless use of FIND, what's wrong, exactly?
A: Your use of %%A in your function. Use %1 instead, and replace the call with CALL :keeppingingdamnyou %%A.
Side note: ping -n 1 %%A >NUL &&GOTO keeppingingdamnyou is easier to type.
EDIT: Actually, there's also a problem with your IF statement. Namely, it triggers only if the server is down. (Read: The exact opposite of what you were looking for.)
Summary: I'm just leaving for work so I'll be brief and add more detail latter. For comparing the lines and search for duplicates, it's easier to use a hash instead of the array. There are several ways to read...
Summary: Can't give you a link but can give you some thoughts on how to do this. I'm assuming that saving the 'blah blah' part of each node to a file is not a problem for you, just the node pointers (left & r...
Summary: Hi, I know there are many different web servers out there. The best open source one is, of course, Apache and I like using a variety of freeware servers for Windows. However, I am interested in progra...