简体   繁体   English

Control-M在每月和每日工作之间添加条件

[英]Control-M add condition between a monthly and a daily job

I'm using control-M for scheduling a few jobs, following is the scenario I face: 我正在使用control-M计划一些作业,以下是我面临的情况:

Job-1 - Runs daily (not at a specific time) 作业1-每天运行(不在特定时间运行)

Job-2 - Ordered on the 1st of every month but runs say around the 10th (not fixed) Job-2-在每月的1号订购,但在10号左右运行(不确定)

Now, I require Job-2 to be dependent on Job-1's execution. 现在,我要求Job-2依赖Job-1的执行。 Say if job-2 becomes "eligible" for execution on the 12th, then it should only execute in the following scenarios:- 假设Job-2在12日变得“有资格执行”,那么它只能在以下情况下执行:

  1. Job-1 for 12th has executed successfully 12号作业1已成功执行
  2. If job-1's execution is not scheduled for the 12th then Job-2 should check for the last successful execution (ie say maybe the 11th) 如果作业1的执行未计划在第12个执行,则作业2应该检查最后一次成功执行(例如,说第11个执行)

Job-2 should not execute if the last execution of Job-1 failed 如果作业1的最后一次执行失败,则作业2不应该执行

What I've tried is, specifying the IN condition on Job-2 with date as PREV, but that doesn't seem to check for the current date's job-1 execution. 我试过的是,在Job-2上将IN条件指定为日期,将其设置为PREV,但这似乎并未检查当前日期的job-1执行情况。

-->for job-1 use out-condition with "Nodate" -->for job-2 use job-1 Nodate outcondition as in-condition. ->对于job-1,请使用带“ Nodate”的超出条件->对于job-2,请使用job-1的Nodate超出条件作为条件。 once this job-2 is ended-ok delete job-1 condition. 一旦该作业2结束,就删除作业1条件。 along with that put an job-2 outcondition with odate. 加上那把工作2淘汰了oate。 -->in job-1 pre-conditions, check for the (job-1 out-condition with no-date OR job-2 out-condition with prev-date) and delete the conditions after use in pre-requisites only. ->在job-1前提条件中,检查(无日期的job-1超出条件或具有prevdate的job-2超出条件),并仅在前提条件中使用后删除条件。

Execution flow. 执行流程。 so, job-1 will run everyday and throws outcondition with nodate into database. 因此,作业1将每天运行,并且将带Nodate的条件排除在数据库之外。 next day when it runs, it checks for the (nodate condition of job-1 OR prev-date out condition of job-2) if any one of them is available, then it accepts that condition and deletes the same condition from database and triggers job-1. 第二天运行时,它会检查(job-1的nodate条件或job-2的prev-date out条件)是否可用,然后接受该条件并从数据库中删除相同条件并触发工作1。

whenever your job-2 is going to run, on that day it will check for the nodate condition of the job-1. 每当Job-2即将运行时,它都会在当天检查Job-1的nodate条件。 if the job-1 is success, then it's nodate outcondition will be available for use and can be used to trigger the job-2. 如果job-1成功,则可以使用nodate outcondition并可以触发job-2。 once job-2 is completed, nodate condition of job-1 will be deleted. 作业2完成后,作业1的指定日期条件将被删除。 and current odate outcondition of job-2 will be used in next day job-1 execution as job-1 nodate condition will not be available for use. 由于第二个作业的nodate条件将不可用,因此第二个作业的当前odate超出条件将在第二天的job-1执行中使用。

Thanks. 谢谢。

There are a few ways to tackle this: 有几种解决方法:

The first would be to have two versions of job 1. The difference between the jobs is in the calandar. 第一种是具有作业1的两个版本。作业之间的区别在于日历。 One runs all days except the day job 2 is to run. 一整天都运行,除了要执行第二天的工作。 the second only runs on day 2, and this job creates the out condition that job 2 uses as an in conditions. 第二个仅在第2天运行,并且此作业创建了作业2作为入场条件使用的出场条件。

Another option is to create an out condition as a post process on job 1, then job 2 uses this condition as an in condition with * * as the odate - remember to remove this condition when job 2 completes (which is always a good practice). 另一种选择是在作业1上创建一个out条件作为后期处理,然后作业2使用此条件作为in条件,而* *为odate-记住在作业2完成时删除此条件(这始终是一个好习惯) 。

syntax is on status = * (or some string in the sysout), compstat = OK, do add condition. 语法为status = *(或sysout中的某些字符串),compstat = OK,请添加条件。

You could also force in job 2 as a post process, add to the on statement do force job. 您还可以在作业2中强制执行作业,将其添加到on语句中即可强制执行作业。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM