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

如何在Autosys中调度每月前5个工作日的作业?求JIL代码片段

Autosys 每月前5个工作日调度的JIL代码片段

方式一:自定义日历(推荐,精确可控)

自定义日历可以精准定义每月前5个工作日的日期,适合需要严格匹配调度日期的场景。

JIL作业定义

insert_job: monthly_first_5_workdays_job
job_type: CMD
command: /path/to/your/execution_script.sh
machine: your_autosys_server
owner: autosys_service_account@your_domain
permission: gx,wx
date_conditions: 1
run_calendar: monthly_first_5_workdays_cal
start_times: "09:00"

自定义日历创建步骤

  1. 编写日历文件(示例:monthly_first_5_workdays.cal),按年份列出每月前5个周一至周五的日期:
2024/01/01,2024/01/02,2024/01/03,2024/01/04,2024/01/05
2024/02/01,2024/02/02,2024/02/05,2024/02/06,2024/02/07
# 后续年份月份依次补充...
  1. 使用autocal_asc工具将日历导入Autosys:
autocal_asc -i monthly_first_5_workdays.cal -c monthly_first_5_workdays_cal

方式二:日期条件表达式(无需自定义日历)

如果仅需排除周末,无需处理法定假日,可以直接通过Autosys内置变量和条件判断实现:

insert_job: monthly_first_5_workdays_job
job_type: CMD
command: /path/to/your/execution_script.sh
machine: your_autosys_server
owner: autosys_service_account@your_domain
permission: gx,wx
date_conditions: 1
days_of_week: mo,tu,we,th,fr
start_mmdd: "01/01"
end_mmdd: "12/31"
# 条件逻辑:覆盖1-5日的工作日,以及当月1日为周末时的顺延情况
condition: '($DAY_OF_MONTH <= 5) OR (($DAY_OF_MONTH <= 7) AND ($DAY_OF_WEEK = 1)) OR (($DAY_OF_MONTH <= 6) AND ($DAY_OF_WEEK = 2))'
start_times: "09:00"

条件说明

  • $DAY_OF_MONTH <=5:匹配当月1-5日的工作日
  • ($DAY_OF_MONTH <=7) AND ($DAY_OF_WEEK =1):当月1日为周日时,前5个工作日会顺延至7日(周一)
  • ($DAY_OF_MONTH <=6) AND ($DAY_OF_WEEK =2):当月1日为周六时,前5个工作日会顺延至6日(周二)

内容的提问来源于stack exchange,提问作者Big data Pyspark

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.03 04:57:13