def generate_Dump_File(type_name, server_name):
#print 'Server Name:'+ server_name
server = '/Server:'+ server_name
# Set the Node ID
serverID = AdminConfig.getid(server)
#print 'Server ID:' + serverID
if serverID == "" :
print "Server Name you have entered does not exist"
else :
jvm = AdminControl.queryNames('type='+type_name+',process='+server_name+',*')
print "####################################"
print "Generating Heap Dump..................\n"
AdminControl.invoke(jvm, 'generateHeapDump')
print "Generating Java Core Dump..................\n"
AdminControl.invoke(jvm, 'dumpThreads')
print "Generating System Core Dump..................\n"
AdminControl.invoke(jvm, 'generateSystemDump')
generate_Dump_File(type_name, server_name)
这是我在 WAS 中执行的代码/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/
上面我执行这个脚本的路径但是我需要每 120 秒执行一次这些脚本,上面的脚本我正在从用户那里获取输入。.在 cron 选项卡中是不可能的..
在完成一次服务器 ID 查找后,您可以在脚本中循环。
import time
while true:
time.sleep(120)
... existing code...
我是一名优秀的程序员,十分优秀!