接前面几篇文章,我没有了 automation script 以后,有时候需要让其定期自动执行,这时候就可以通过 Cron Task 来实现了。
request:
POST {{base_url}}/api/os/mxapicrontaskdef?apikey={{api_key}}&lean=1
headers:
Content-Type: application/json
properties: *
body:
{
"crontaskname": "mycrontask",
"description": "my cron task definition",
"classname": "com.ibm.tivoli.maximo.script.ScriptCrontask",
"accesslevel": "FULL",
"crontaskinstance": [
{
"instancename": "<automation script name>",
"schedule": "1m,*,*,*,*,*,*,*,*,*",
"active": true,
"runasuserid": "MAXADMIN",
"keephistory": true,
"maxhistory": 100,
"crontaskparam": [
{
"parameter": "SCRIPTARG",
"value": ""
}, {
"parameter": "SCRIPTNAME",
"value": "<automation script name>"
}
]
}
]
}
其中 <automation script name> 是我们创建的 automation script 实例,并且设置每分钟运行一次。
通过maximo ui参考cron task instance的History,可以看到定期执行历史。