Inicial > weblogic, wlst > Stop Start Weblogic Server

Stop Start Weblogic Server

Recentemente fiz um script para parar e iniciar todos servers de um domínio weblogic, bem mais complexo pois tinha cluster e dois node Manager, era necessário subir cada Node depois conectar via node e subir todos servidores da lista de Mbeans do AdminServer.

Esse script você coloca o nome de um servidor específico e ele faz o Stop e Start via AdminServer.

  1. cria-se um arquivo restartServer.py com o seguinte conteúdo:

    import getopt
    ################################################################
    # Script para reniciar um server do weblogic.
    ################################################################
    # 1 – Conecta no AdminServer
    # 2 – Para o servidor
    # 3 – Inicia o servidor
    #
    # @author Herivelto Gabriel
    # @Date Abril/2014
    ###############################################################

    ################################################################
    # Variaveis.
    ################################################################
    adminusername=’weblogic’
    adminpassword=’weblogic11′
    adminurl=’t3://172.18.4.62:7001′
    serverRestart=’Server-DB’

    ################################################################
    # Conecta no AdminServer entra em runtime e ler o server
    ################################################################

    connect(adminusername, adminpassword, adminurl)
    domainRuntime()

    ################################################################
    # STOP – Server
    ################################################################
    bean = getMBean(‘ServerRuntimes/’ + serverRestart)
    if bean:
    print ”
    print ‘======================================’
    print ‘ STOP Server, Please wait……….!!!’
    print ‘======================================’
    shutdown(serverRestart, ‘Server’ , force=’true’)
    print ‘======================================’
    print ‘ START Server, Please wait…………….!!!’
    print ‘======================================’
    start(serverRestart, ‘Server’, block=’true’)
    print ‘======================================’
    print ‘Started Server ‘ + serverRestart
    print ‘======================================’
    print ”
    print ”

    ################################################################
    # START – Server
    ################################################################

    bean = getMBean(‘ServerRuntimes/’ + serverRestart)
    if bean:
    print ‘Server ‘ + serverRestart + ‘ is ‘ + bean.getState()
    else:
    print ”
    print ‘======================================’
    print ‘ START Server, Please wait…………….!!!’
    print ‘======================================’
    start(serverRestart, ‘Server’, block=’true’)
    print ‘======================================’
    print ‘Started Server ‘ + serverRestart
    print ‘======================================’
    print ”
    print ”

    ################################################################
    # Desconecta e sai do script
    ################################################################
    disconnect()
    exit()

  2. Excutando o script:

    /var/Oracle/Middleware/wlserver/common/bin/wlst.sh restartServer.py

  3. Saída do Script:

    ===================================================
    STOP Server, Please wait……………..!!!
    ===================================================
    Shutting down the server Server-DB with force=true while connected to AdminServer …
    ===================================================
    START Server, Please wait…………….!!!
    ===================================================
    Starting server Server-DB ……………
    Server with name Server-DB started successfully
    ===================================================
    Started Server Server-DB !!
    ==================================================

Anúncios
Categorias:weblogic, wlst Tags:
  1. Nenhum comentário ainda.
  1. No trackbacks yet.

Deixe um comentário

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair /  Alterar )

Foto do Google+

Você está comentando utilizando sua conta Google+. Sair /  Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair /  Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair /  Alterar )

w

Conectando a %s

%d blogueiros gostam disto: