Advertisement
m4ly

WLST StopAdminServer.py

Aug 20th, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.55 KB | None | 0 0
  1. # Author: Dawid Mocek
  2. # All rights reserved
  3.  
  4. import os
  5. import sys
  6. import traceback
  7.  
  8. exitonerror='true'
  9. stdoutDevice = sys.stdout
  10.  
  11. class NullDevice(object):
  12.     def write(self, s):
  13.         pass
  14.  
  15. #def stdoutEnable(enabled=true):
  16. #    if enabled:
  17. #       sys.stdout = stdoutDevice
  18. #    else:
  19. #       sys.stdout = NullDevice()
  20. #
  21. #
  22. #redirect('/dev/null', 'false')
  23. # sys.stdout = NullDevice()
  24. # sys.stderr = NullDevice()
  25.  
  26. try:
  27.  
  28. #    print "Connecting to NodeManager " + NodeManagerListenAddress + ":" + NodeManagerListenPort + " using mode " + NodeManagerListenMode
  29.  
  30.     g = nmConnect(username = NodeManagerUser, password = NodeManagerPassword, host = NodeManagerListenAddress, port = NodeManagerListenPort,domainName= DomainName, domainDir = DomainHome, nmType = NodeManagerListenMode, verbose = 'false')
  31.     # print "log: " + nmLog()
  32.     sys.stdout.write('Stoping ' + AdminServerName + '... ')
  33.     adminServerStatus = nmServerStatus(AdminServerName)
  34.  
  35.     if adminServerStatus != "RUNNING":
  36.         raise Exception("AdminServer is in " + adminServerStatus + " state. Cannot stop")
  37.  
  38.     # http://docs.oracle.com/cd/E24329_01/web.1211/e24491/manage_servers.htm#WLSTG170
  39.     # Using Node Manager to Start Servers on a Machine
  40.     # 7. Stop the server by entering the nmKill command.
  41.     nmKill(AdminServerName)
  42.  
  43. #    print "Disconnecting from NodeManager"
  44. except WLSTException, e:
  45.     nmDisconnect()
  46.     sys.exit("FAILED: " + str(e))
  47. except Exception, e:
  48.     nmDisconnect()
  49.     sys.exit("FAILED: " + e.getMessage())
  50. else:
  51.      nmDisconnect()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement