Tutorial - Creating your first job flow - BMC Documentation
文章推薦指數: 80 %
Step 2 - Verify the code for Control-M Search Productversion 9.0.20.240 9.0.20.200 9.0.20.100 9.0.20 9.0.19.200 9.0.19.100 9.0.19 9.0.18.200 9.0.18.100 9.0.18 9.0.00.500 BMCSupportCentral BMCCommunity BMC.com Tutorials-Settinguptheprerequisites Inthistopic Wasthispagehelpful? Comments Tutorial-Automatingcodedeployment Control-MAutomationAPI9.0.18 Tutorials Tutorial-Creatingyourfirstjobflow Thisexampleshowshowtowritecommandandscriptjobsthatruninsequence. BeforeyoubeginEnsurethatyouhavesetupyourenvironment,asdescribedinSettinguptheprerequisites.Step1-AccessthetutorialsamplesGotothedirectorywherethetutorialsampleislocated:cdautomation-api-quickstart/control-m/101-create-first-job-flow Step2-VerifythecodeforControl-MLet'staketheAutomationAPISampleFlow.jsonfile,whichcontainsjobdefinitions,andverifythatthecodewithinitisvalid. Todoso,usethe build command. Thefollowingexampleshowsthecommandandatypicalsuccessfulresponse.>ctmbuildAutomationAPISampleFlow.json [ { "deploymentFile":"AutomationAPISampleFlow.json", "successfulFoldersCount":0, "successfulSmartFoldersCount":1, "successfulSubFoldersCount":0, "successfulJobsCount":2, "successfulConnectionProfilesCount":0, "isDeployDescriptorValid":false } ] Ifthecodeisnotvalid,anerrorisreturned.Step3-RunthesourcecodeUsethe run commandtorunthejobsontheControl-Menvironment.Thereturned runId isusedtocheckthejobstatus. Thefollowingshowsthecommandandatypicalsuccessfulresponse.>ctmrunAutomationAPISampleFlow.json { "runId":"7cba67de-9e0d-409d-8d93-1b8229432eee", "statusURI":"https://localhost:8443/automation-api/run/status/7cba67de-9e0d-409d-8d93-1b82294e?token=4f8684ec6754e08cc70f95b5f09d3a47_A1FD0E65", "monitorPageURI":"https://localhost:8443/SelfService#Workbench:runid=7cba67de-9e0d-409d-8d93-29432eee&title=AutomationAPISampleFlow.json" } Thiscoderansuccessfullyandreturnedthe runId of"7cba67de-9e0d-409d-8d93-1b8229432eee".Step4-Checkjobstatususingthe runIdThefollowingcommandshowshowtocheckjobstatususingthe runId.Notethatwhenthereismorethanonejobintheflow,thestatusofeachjobischeckedandreturned.>ctmrunstatus"7cba67de-9e0d-409d-8d93-1b8229432eee" { "statuses":[ { "jobId":"workbench:00007", "folderId":"workbench:00000", "numberOfRuns":1, "name":"AutomationAPISampleFlow", "type":"Folder", "status":"Executing", "startTime":"Apr26,201710:43:47AM", "endTime":"", "outputURI":"Folderhasnooutput", "logURI":"https://localhost:8443/automation-api/run/job/workbench:00007/log?token=01ab65917bc71dbef610806dd9cb3f94_0007C46B" }, { "jobId":"workbench:00008", "folderId":"workbench:00007", "numberOfRuns":0, "name":"CommandJob", "folder":"AutomationAPISampleFlow", "type":"Command", "status":"WaitHost", "startTime":"", "endTime":"", "outputURI":"Jobdidnotrun,ithasnooutput", "logURI":"https://localhost:8443/automation-api/run/job/workbench:00008/log?token=01ab65917bc71dbef610806dd9cb3f94_0007C46B" }, { "jobId":"workbench:00009", "folderId":"workbench:00007", "numberOfRuns":0, "name":"ScriptJob", "folder":"AutomationAPISampleFlow", "type":"Job", "status":"WaitCondition", "startTime":"", "endTime":"", "outputURI":"Jobdidnotrun,ithasnooutput", "logURI":"https://localhost:8443/automation-api/run/job/workbench:00009/log?token=01ab65917bc71dbef610806dd9cb3f94_0007C46B" } ], "startIndex":0, "itemsPerPage":25, "total":3, "monitorPageURI":"https://localhost:8443/SelfService#Workbench:runid=7cba67de-9e0d-409d-8d93-1b8229432eee&title=Status_7cba67de-9e0d-409d-8d93-1b8229432eee" Step5-ExaminethesourcecodeLet'slookatthesourcecodeintheAutomationAPISampleFlow.jsonfile.Byexaminingthecontentsofthisfile,you'lllearnaboutthestructureofthejobflowandwhatitshouldcontain.{ "Defaults":{ "Application":"SampleApp", "SubApplication":"SampleSubApp", "RunAs":"USERNAME", "Host":"HOST", "Job":{ "When":{ "Months":["JAN","OCT","DEC"], "MonthDays":["22","1","11"], "WeekDays":["MON","TUE","WED","THU","FRI"], "FromTime":"0300", "ToTime":"2100" }, "ActionIfFailure":{ "Type":"If", "CompletionStatus":"NOTOK", "mailToTeam":{ "Type":"Mail", "Message":"%%JOBNAMEfailed", "To":"[email protected]" } } } }, "AutomationAPISampleFlow":{ "Type":"Folder", "Comment":"CodereviewedbyJohn", "CommandJob":{ "Type":"Job:Command", "Command":"echomy1stjob" }, "ScriptJob":{ "Type":"Job:Script", "FilePath":"SCRIPT_PATH", "FileName":"SCRIPT_NAME" }, "Flow":{ "Type":"Flow", "Sequence":["CommandJob","ScriptJob"] } } } Thefirstobjectiscalled"Defaults".Itallowsyoutodefineaparameteronceforallobjects.Forexample,itincludesschedulingusingtheWhen parameter,whichconfiguresalljobstorunaccordingtothesameschedulingcriteria.The"ActionIfFailure"objectdetermineswhatactionistakenifajobendsunsuccessfully.Thisexamplecontainstwojobs:CommandJob andScriptJob.Thesejobsarecontainedwithinafolder namedAutomationAPISampleFlow.Todefinethesequenceofjobexecution,theFlow objectisused.Step6-ModifythecodetoruninyourenvironmentInthecodeabove,thefollowingparametersneedtobesettorunthejobsinyourenvironment: "RunAs":"USERNAME" "Host":"HOST" "FilePath":"SCRIPT_PATH" "FileName":"SCRIPT_NAME" RunAs identifiestheoperatingsystemuserthatwillexecutethejobs.Host definesthemachinewherethejobswillrun.ThismachineshouldhaveaControl-M/Agentinstalled. FilePath andFileName definethelocationandnameofthefilethatcontainsthescripttorunontheControl-M/Agent.ChangethevaluestosuityourControl-Menvironment.InaControl-MWorkbenchenvironment,changethevaluesofthefollowingparametersasshownintheexamplebelow. Theag_diag_commscriptreturnsacommunicationreport. "RunAs":"workbench" "Host":"workbench" "FilePath":"/home/workbench/ctm/scripts" "FileName":"ag_diag_comm" Step7-RerunthecodesampleNowthatwe'vemodifiedthesourcecodeintheAutomationAPISampleFlow.jsonfile,let'srerunthesample:>ctmrunAutomationAPISampleFlow.json { "runId":"ed40f73e-fb7a-4f07-a71c-bc2dfbc48494", "statusURI":"https://localhost:8443/automation-api/run/status/ed40f73e-fb7a-4f07-a71c-bc2dfbc48494?token=460e0106b369a0d155bb0e7cbb44f8eb_7E6C03FA", "monitorPageURI":"https://localhost:8443/SelfService#Workbench:runid=ed40f73e-fb7a-4f07-a71c-bc2dfbc48494&title=AutomationAPISampleFlow.json" } Eachtimeyourunthecode,anew runId isgenerated.Let'stakethenew runId,andcheckthejobsstatusesagain:>ctmrunstatus"ed40f73e-fb7a-4f07-a71c-bc2dfbc48494" { "statuses":[ { "jobId":"workbench:0000p", "folderId":"workbench:00000", "numberOfRuns":1, "name":"AutomationAPISampleFlow", "type":"Folder", "status":"EndedOK", "startTime":"May3,20174:57:25PM", "endTime":"May3,20174:57:28PM", "outputURI":"Folderhasnooutput", "logURI":"https://localhost:8443/automation-api/run/job/workbench:0000p/log?token=a8d74f5914dc6decdfd8b2ec833d54cc_3E30FFC9" }, { "jobId":"workbench:0000q", "folderId":"workbench:0000p", "numberOfRuns":1, "name":"CommandJob", "folder":"AutomationAPISampleFlow", "type":"Command", "status":"EndedOK", "startTime":"May3,20174:57:26PM", "endTime":"May3,20174:57:26PM", "outputURI":"https://localhost:8443/automation-api/run/job/workbench:0000q/output?token=a8d74f5914dc6decdfd8b2ec833d54cc_3E30FFC9", "logURI":"https://localhost:8443/automation-api/run/job/workbench:0000q/log?token=a8d74f5914dc6decdfd8b2ec833d54cc_3E30FFC9" }, { "jobId":"workbench:0000r", "folderId":"workbench:0000p", "numberOfRuns":1, "name":"ScriptJob", "folder":"AutomationAPISampleFlow", "type":"Job", "status":"EndedOK", "startTime":"May3,20174:57:27PM", "endTime":"May3,20174:57:27PM", "outputURI":"https://localhost:8443/automation-api/run/job/workbench:0000r/output?token=a8d74f5914dc6decdfd8b2ec833d54cc_3E30FFC9", "logURI":"https://localhost:8443/automation-api/run/job/workbench:0000r/log?token=a8d74f5914dc6decdfd8b2ec833d54cc_3E30FFC9" } ], "startIndex":0, "itemsPerPage":25, "total":3, "monitorPageURI":"https://localhost:8443/SelfService#Workbench:runid=ed40f73e-fb7a-4f07-a71c-bc2dfbc48494&title=Status_ed40f73e-fb7a-4f07-a71c-bc2dfbc48494" } YoucannowseethatbothjobsEndedOK.Let'sviewtheoutputof CommandJob.Usethe jobId togetthisinformation,asinthefollowingexample:>ctmrunjob:output::get"workbench:0000q" +echomy1stjob my1stjob Step8-ViewjobdetailsthroughaninteractiveinterfaceControl-MWorkbenchoffersaninteractiveuserinterfacefordebuggingpurposes.Throughthisinterface,youcanviewvariousjobrundetails(including,forexample,anactivitylogandstatisticsforeachjob).Tolaunchthisinterfacewhenyourunjobs,enter"--interactive"or"-i"attheendoftherun command.>ctmrunAutomationAPISampleFlow.json--interactive { "runId":"40586805-60b5-4acb-9f21-a0cf048f1051", "statusURI":"https://ec2-54-187-1-168.us-west-2.compute.amazonaws.com:8443/run/status/40586805-60b5-4acb-9f21-a0cf048f1051", "monitorPageURI":"https://localhost:8443/SelfService#Workbench:runid=40586805-60b5-4acb-9f21-a0cf048f1051&title=AutomationAPISampleFlow.json } Abrowserwindowopens,whereyoucanviewandmanageyourjobs.WheretogofromhereTolearnmoreaboutwhatyoucandowiththeControl-MAutomationAPI,readthroughthe CodeReference and AutomationAPIServices. Proceedtothenexttutorial,whereyouwilllearnhowtorunapplicationsandprogramsinyourdevelopmentenvironment. Wasthispagehelpful?YesNo Submitting... Whatiswrongwiththispage? Confusing Missingscreenshots,graphics Missingtechnicaldetails Needsavideo Notcorrect NottheinformationIexpected Yourfeedback: Send Skip Thankyou Lastmodifiedby YechezkelSchatz on Jan26,2021 api sdk ctm scripts script shell connectionprofile programmer devops appdev controlm scheduling services flow batch workflow workload google automation Comments Login orregistertocomment. Tutorials-Settinguptheprerequisites Tutorial-Automatingcodedeployment
延伸文章資訊
- 1Control-M Scheduling Overview - YouTube
0:19• Control-M New Day - 1:23• S... ... folder and jobs in Control-M. • Introduction - 0:05 • Wh...
- 21. Control-M 8.0 Beginners Guide - Introduction to ... - YouTube
How to start working with Control-M 8.0. Creating workspace and simple jobs, conditions and resou...
- 3Connect with Control-M: Job Scheduling Techniques - YouTube
Connect with Control-M: Job Scheduling Techniques. 103,629 views103K views. Sep 6, 2016 ... BMC ...
- 4Control-M Workload Automation Documentation
Control-M documentation is available in Help and PDF format. Older versions of Control-M are avai...
- 5Tutorial - Creating your first job flow - BMC Documentation
Step 2 - Verify the code for Control-M