Skip to content
Advertisement

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)

This is the code I am executing in WAS /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/

The above path where i am executing this script But i need execute those script for every 120 seconds, above script i am getting input from user.. In cron tab is not possible..

Advertisement

Answer

I have added the code below to execute jython script for every 120 seconds to generate dump in IBM Websphere

def print_time( threadName, delay):
while 1: time.sleep(delay) print "%s: %s" % ( threadName, time.ctime(time.time()) )
execute code here try: thread.start_new_thread( print_time, ("Thread", 120, ) )
except: print "Error: unable to start thread" while 1: pass

Above code works fine for me..

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement