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 ?
Need Suggestion for rebooting servers via job
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,
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,
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%
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%