linux 如何在 IBM WebSphere Application Server 中每 120 秒执行一次 jython 脚本?
How to execute jython script for every 120 seconds in IBM WebSphere Application Server in linux?
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 选项卡中是不可能的..
完成 one-time 服务器 ID 查找后,您可以在脚本中循环。
import time
while true:
time.sleep(120)
... existing code...
我添加了下面的代码以每 120 秒执行一次 jython 脚本以在 IBM Websphere 中生成转储
def print_time( threadName, delay):<br>
而 1:
time.sleep(延迟)
print "%s: %s" % ( threadName, time.ctime(time.time()) )<br>
在这里执行代码
尝试:
thread.start_new_thread( print_time, ("Thread", 120, ) )<br>
除了:
打印 "Error: unable to start thread"
而 1:
经过
上面的代码对我来说很好..
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 选项卡中是不可能的..
完成 one-time 服务器 ID 查找后,您可以在脚本中循环。
import time
while true:
time.sleep(120)
... existing code...
我添加了下面的代码以每 120 秒执行一次 jython 脚本以在 IBM Websphere 中生成转储
def print_time( threadName, delay):<br>
而 1:
time.sleep(延迟)
print "%s: %s" % ( threadName, time.ctime(time.time()) )<br>
在这里执行代码
尝试:
thread.start_new_thread( print_time, ("Thread", 120, ) )<br>
除了:
打印 "Error: unable to start thread"
而 1:
经过
上面的代码对我来说很好..