Question

currently I am doing a project using the Control-M to run the Control-M jobs.

and also a current project from other team is using Hudson to trigger the Spring Batch jobs.

I know that Control-M jobs can be converted to the Spring Batch jobs but I want to know if it is possible to have Control-M jobs triggered by the Hudson agent?

Thank you!

Was it helpful?

Solution

Short answer is yes. I frequently use Jenkins to enable developers to run Control M jobs. The whole self service configuration can be avoided this way, as long as the Jenkins/Hudson user is allowed to run the jobs.

1. I need to start the job

#Run job and capture order number 
OUTPUT="$(${controlm_path}/ctm/exe/ctmorder -TABLE "${TABLE_NAME}" -NAME "${JOB_NAME}" -ODATE "$(date +%Y%m%d)" -FORCE y -autoedit %%PARM1 ${server}  -autoedit %%PARM2 ${action} )"
echo "${OUTPUT}"
ORDERNUM="$(echo "$OUTPUT" |grep orderno= |cut -f 3 -d , | cut -f 2 -d \' )"
echo "Order Number: $ORDERNUM"

2. Wait for job being done

#Get all job statusses and check if the state of our job is in "Post pro" status (that means it is done)
  STATUS_LINE=$(${controlm_path}/ctm/exe/ctmpsm -LISTALL TIME | grep "$ORDERNUM.*Post pro")

3. get logs

${controlm_path}/ctm/exe/ctmpsm -LISTSYSOUT ${ORDERNUM} > logs/mylog.log

4. if job takes too long, kill it with following command

${controlm_path}/ctm/exe/ctmkilljob -ORDERID $ORDERNUM

These 4 basic commands I have a neat little shell script, which I run on a unix machine that has the ControlM client installed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top