Advertisement
IsraelTorres

reboot-server-pool.bat

Jun 21st, 2011
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.06 KB | None | 0 0
  1. @ECHO OFF
  2. :: ISRAEL TORRES
  3. :: 2011/06/20
  4. :: Q&D Script to make sure that two of the 4 servers remain up during
  5. ::  - cleansing cycle since the dev team sassafras can't figure out
  6. ::  - how to fix the memory leaks (FAIL)
  7. :: Works great in Windows Server 2008R2 (porting to bash next rev)
  8. :: todo: replace ping with java service content match
  9.  
  10. SET SERVER1=aaa
  11. SET SERVER2=bbb
  12. SET SERVER3=ccc
  13. SET SERVER4=ddd
  14.  
  15. SET CNTR=0
  16. SHUTDOWN -r -f -t 0 -m \\%SERVER1%
  17.  
  18. CALL:CHECKPOOL
  19. IF %CNTR% LSS 2 CALL:CHECKPOOL
  20.  
  21. SHUTDOWN -r -f -t 0 -m \\%SERVER2%
  22. IF %CNTR% LSS 2 CALL:CHECKPOOL
  23.  
  24. SHUTDOWN -r -f -t 0 -m \\%SERVER3%
  25. IF %CNTR% LSS 2 CALL:CHECKPOOL
  26.  
  27. SHUTDOWN -r -f -t 0 -m \\%SERVER4%
  28. GOTO STOPJOB
  29.  
  30. :CHECKPOOL
  31. SET CNTR=0
  32. sleep 900
  33. ping -n 1 %SERVER1% >NUL && SET /A CNTR=CNTR+1
  34. ping -n 1 %SERVER2% >NUL && SET /A CNTR=CNTR+1
  35. ping -n 1 %SERVER3% >NUL && SET /A CNTR=CNTR+1
  36. ping -n 1 %SERVER4% >NUL && SET /A CNTR=CNTR+1
  37. GOTO:EOF
  38.  
  39. :STOPJOB
  40. ECHO everything went better than expected :)
  41.  
  42. :GOODBYE
  43. SET SERVER1=
  44. SET SERVER2=
  45. SET SERVER3=
  46. SET SERVER4=
  47. SET CNTR=
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement