You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Autosys作业执行跳过需求咨询:指定时间未满足条件则当日跳过次日正常执行

Solution for Autosys Job: Run Only in Time Window, Skip Day if Prereq Not Met Before Window

Let's break down how to implement this requirement—your job should run only within a defined daily time window, and if its prerequisites aren't met before the window starts, it skips that day's execution but resumes normally the next day. Here are two proven approaches I've used in production environments:

Approach 1: Prerequisite Check + Manual Skip Trigger

This method uses a pre-window check job to verify prerequisites, then triggers a skip if they're unmet.

Step 1: Define the Target Job

First, set up your core job with the time window and dependency condition. It will only run if the prereq is met and it's within the window:

insert_job: MY_DAILY_JOB
job_type: CMD
command: /opt/scripts/my_job_script.sh
machine: prod-app-01
start_time: 09:00
end_time: 17:00
condition: s(PRE_REQ_JOB)  # Only run if PRE_REQ_JOB succeeded
run_calendar: STANDARD_WORKDAYS  # Optional: restrict to workdays

Step 2: Add a Pre-Window Prerequisite Check

Create a job that runs 5-10 minutes before the window starts to check if the prerequisite is done. Use a custom script to validate the job status:

insert_job: CHECK_PREREQ_BEFORE_WINDOW
job_type: CMD
command: /opt/scripts/check_prereq_status.sh PRE_REQ_JOB
machine: prod-app-01
start_time: 08:55
run_calendar: STANDARD_WORKDAYS
exit_code: 0=SUCCESS, 1=FAILURE

The check_prereq_status.sh script can use autorep -J $1 -s to fetch the job's status, returning 0 if it succeeded, 1 otherwise.

Step 3: Trigger Skip if Prereq Fails

Create a job that runs right after the check, and sends a SKIP event to the target job if the check failed:

insert_job: SKIP_JOB_IF_PREREQ_MISSING
job_type: CMD
command: sendevent -E SKIP -J MY_DAILY_JOB
machine: prod-app-01
start_time: 08:56
condition: f(CHECK_PREREQ_BEFORE_WINDOW)  # Trigger only if check failed
run_calendar: STANDARD_WORKDAYS

Why this works: If the prereq isn't completed by 08:55, the skip job marks MY_DAILY_JOB as SKIPPED for the day. Autosys won't attempt to run it again that day, but since it's a daily job, it will reset and check again the next morning automatically.

Approach 2: Box Job with Conditional Flow

For cleaner organization, wrap all logic in a box job that runs daily. This makes dependency management more intuitive:

insert_job: DAILY_JOB_BOX
job_type: BOX
machine: prod-app-01
start_time: 08:50
run_calendar: STANDARD_WORKDAYS

# Inside the box:
insert_job: CHECK_PREREQ
job_type: CMD
command: /opt/scripts/check_prereq_status.sh PRE_REQ_JOB
machine: prod-app-01
box_name: DAILY_JOB_BOX
exit_code: 0=SUCCESS,1=FAILURE

insert_job: RUN_TARGET_JOB
job_type: CMD
command: /opt/scripts/my_job_script.sh
machine: prod-app-01
box_name: DAILY_JOB_BOX
start_time: 09:00
end_time: 17:00
condition: s(CHECK_PREREQ)

insert_job: SKIP_TARGET_JOB
job_type: CMD
command: sendevent -E SKIP -J RUN_TARGET_JOB
machine: prod-app-01
box_name: DAILY_JOB_BOX
condition: f(CHECK_PREREQ)

Key Notes

  • The SKIP event is critical here—it prevents the job from lingering in INACTIVE/WAITING state, which would block it from resetting the next day.
  • Always test the time window and condition logic in a non-production environment first to validate behavior.
  • If using a run calendar, ensure it aligns with your daily execution schedule (e.g., exclude weekends/holidays if needed).

内容的提问来源于stack exchange,提问作者deepak_gj

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 02:27:54