2016-03-18 45 views
0

我試圖停下來,在遠程服務器上使用一些shell腳本通過蟒蛇開始Webshpere的JVM實例:的Websphere部分停止發行

代碼:

def stop_AppServer_75(): 
    try: 
     client = paramiko.SSHClient() 
     client.load_system_host_keys() 
     client.set_missing_host_key_policy(paramiko.WarningPolicy()) 

     client.connect(Apphost4, port=port, username=username, password=password) 

     stdin, stdout, stderr = client.exec_command('/application/IBM/WASProfiles/PERF_N04/bin/stopServer.sh app04_smtsrch_inst01') 
     print stdout.read() 
     stdin, stdout, stderr = client.exec_command('/application/IBM/WASProfiles/PERF_N04/bin/stopServer.sh app04_smtsrch_inst02') 
     print stdout.read() 

    finally: 
     client.close() 

但有時實例卡住成部分停止Partial Stop狀態,直到我必須選擇實例並明確地從控制檯終止直到那時我的代碼無法繼續進行。

我需要兩樣東西:

  1. 如何終止該實例,如果它是在部分停止狀態的命令行或通過腳本。

  2. 我的代碼如何檢測實例是否已進入部分停止狀態,以便它可以運行上述步驟。

在錯誤日誌Webshere:

[3/18/16 3:03:53:004 EDT] 00000001 AdminTool  A ADMU3201I: Server stop request issued. Waiting for stop status. 
[3/18/16 3:23:53:105 EDT] 00000001 AdminTool  A ADMU3111E: Server stop requested but failed to complete. 
[3/18/16 3:23:53:111 EDT] 00000001 WsServerStop E ADMU3002E: Exception attempting to process server app01_ocl_inst01 
[3/18/16 3:23:53:114 EDT] 00000001 WsServerStop E ADMU3007E: Exception com.ibm.websphere.management.exception.AdminException: ADMU3060E: Timed out waiting for server shutdown. 
[3/18/16 3:23:53:119 EDT] 00000001 WsServerStop A ADMU3007E: Exception com.ibm.websphere.management.exception.AdminException: ADMU3060E: Timed out waiting for server shutdown. 
     at com.ibm.ws.management.tools.WsServerStop.runTool(WsServerStop.java:433) 
     at com.ibm.ws.management.tools.AdminTool.executeUtility(AdminTool.java:269) 
     at com.ibm.ws.management.tools.WsServerStop.main(WsServerStop.java:112) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:94) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55) 
     at java.lang.reflect.Method.invoke(Method.java:619) 
     at com.ibm.wsspi.bootstrap.WSLauncher.launchMain(WSLauncher.java:234) 
     at com.ibm.wsspi.bootstrap.WSLauncher.main(WSLauncher.java:96) 
     at com.ibm.wsspi.bootstrap.WSLauncher.run(WSLauncher.java:77) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:94) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55) 

回答

0

既然你不是已經使用wsadmin,沒有一個真正的WAS具體的答案。

你可以這樣做:休眠一段固定的時間,尋找一個持續的java進程,並以「app04_smtsrch_inst02」作爲最後一個參數,併發送kill -TERM,休眠一段時間,然後發送kill -9。