Page 1 of 1

Need Suggestion for rebooting servers via job

Posted: 09 May 2011 8:25
by Hubba
We have 8 servers that cannot be down at the same time. I'm trying to setup a job to reboot each server after it has been patched. I have the first job executing a shutdown reboot command. The second job I'd like to have is a job that pings the server. Upon a successful ping and job end, I'd like to repeat the process till all 8 servers have been sucessfully rebooted.

The problem that I'm running into is that the first job ends before the reboot is successful and the second job kicks off and it sucessfully pings because at that exact time the server is still up, but on it's way down. We are running windows, not unix.

Anyone have a script that would do this ?

Posted: 10 May 2011 4:31
by Nikhil
In my work environment, there is a workaround created for this.
First the reboot job runs.
Then a second wait job runs that has a sleep command. So it runs for 5 minutes doing nothing
Then the check job runs which is set up as cyclic to ping the server. Once the job completes successfully the cyclic is stopped and the next job starts.

Hope that helps,

Posted: 10 May 2011 4:36
by Hubba
What are you using for the ping job? A script?, a single command?

Posted: 24 May 2011 4:17
by Hubba
Answer anyone?

Posted: 25 May 2011 3:50
by Hubba
Nikhil,

The reason we can't use the sleep command is that we want to use remote hosts on the servers and not have to load an agent.

Anyone have any other suggestions?

Posted: 25 May 2011 5:46
by gglau
Job1 to shutdown Server1: NodeID = Server1; command = WaitShut.cmd
Job2 to shutdown Server1: NodeID = Server2; command = WaitShut.cmd Server1
Job3 to shutdown Server1: NodeID = Server3; command = WaitShut.cmd Server2
so on and so forth

Job1 link to Job2 link to Job3 ...

WaitShut.cmd
==========
if "%1" EQU "" goto SHUT

REM sleep interval in seconds
set SLEEP=60

:WAIT
timeout /t %SLEEP% > NUL
ping -n 1 %1 | find /i "destination host unreachable"
if errorlevel 1 goto WAIT

:SHUT
REM relevant shutdown parameters
set PARAMETERS=/r /f /t 5 /d p:0:0
shutdown %PARAMETERS%

Posted: 26 Oct 2012 5:11
by mauriziog
you can do a second job (ping server) on another agent (server agent for example) and use:
- a command Job "ping ServerName"
- in panel set of the same command job use the "%%PRECMD=sleep 300"