Need Suggestion for rebooting servers via job

Several scripts
Post Reply
User avatar
Hubba
Nouveau
Nouveau
Posts: 69
Joined: 10 Dec 2007 12:00
Location: Boston

Need Suggestion for rebooting servers via job

Post by Hubba » 09 May 2011 8:25

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 ?

User avatar
Nikhil
Nouveau
Nouveau
Posts: 1
Joined: 10 May 2011 12:00

Post by Nikhil » 10 May 2011 4:31

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,

User avatar
Hubba
Nouveau
Nouveau
Posts: 69
Joined: 10 Dec 2007 12:00
Location: Boston

Post by Hubba » 10 May 2011 4:36

What are you using for the ping job? A script?, a single command?

User avatar
Hubba
Nouveau
Nouveau
Posts: 69
Joined: 10 Dec 2007 12:00
Location: Boston

Post by Hubba » 24 May 2011 4:17

Answer anyone?

User avatar
Hubba
Nouveau
Nouveau
Posts: 69
Joined: 10 Dec 2007 12:00
Location: Boston

Post by Hubba » 25 May 2011 3:50

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?

User avatar
gglau
Nouveau
Nouveau
Posts: 317
Joined: 13 Jun 2007 12:00

Post by gglau » 25 May 2011 5:46

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%

User avatar
mauriziog
Nouveau
Nouveau
Posts: 807
Joined: 08 Jun 2007 12:00
Location: Varese - Italy
Contact:

Post by mauriziog » 26 Oct 2012 5:11

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"

Post Reply