Pages

Monday, April 20, 2020

Run automation script as cron task in Maximo 7.6+

You can use a script to run the cron task by using a Java Class com.ibm.tivoli.maximo.script.ScriptContask in the cron task definition and then attach the automation script to the cron task in parameters. For this script, we don't need a launch point.


  1. Create a script in Automation Scripts application. 
    Select Action > Create Script
  2. Since it is not having any launch point, you cannot specify bindings to a Maximo Business Object. You can only specify LITERAL, MAXVARS and SYSPROP bindings.
  3. Enter the source code and click on Create.
  4. Go to > System Configuration > Platform Configuration > Cron Task Setup application and search for cron task with class com.ibm.tivoli.maximo.script.ScriptCrontask.
  5. If there is no cron task exists, create a New Cron Task and specify the class as com.ibm.tivoli.maximo.script.ScriptCrontask.
  6. Add a new row in Cron Task Instance section and specify a name, schedule and run as user.
  7. In the Parameters Section specify the SCRIPTNAME, which you have created in Automation Scripts application and SCRIPTARG, which is the argument you want to pass to the script.
    SCRIPTNAME is a mandatory field and SCRIPTARG is optional. SCRIPTNAME will be passed to the automation script as scriptName implicit variable.
  8. In the Cron Task Instances section, click on ACTIVE check box and save the record.
Automation Scirpt Cron Task



Variable in Automation Script for Cron Tasks


Below are the variables that are available in the Automation Script.

  1. scriptName: scriptName refers to the name of the script that is run as Cron Task.
  2. qName: qName refers to the name of the Cron Task instance that is running the Automation Script.
  3. runAsUserInfo: runAsUserInfo returns the psdi.security.UserInfo java object. You can use this variable to get additional information about the user that is associated with the Cron Task Instance.

No comments:

Post a Comment