AutoSys date_conditions and run_window — Time Gating Explained
- date_conditions is the master switch — must be 1 for start_times, days_of_week, and run_calendar to take effect
- run_window defines when a job is permitted to run — for FW jobs it enforces detection; for CMD jobs it's advisory
- term_run_time is the hard kill for CMD jobs, not run_window
Two attributes that beginners often misuse: date_conditions and run_window. They sound related but they do different things. date_conditions determines whether time-based scheduling is active at all. run_window defines the hours during which a job is permitted to execute. Understanding the distinction prevents a lot of scheduling confusion.
date_conditions deep dive
date_conditions is binary — 0 or 1. When it's 0 (the default), the job has no time-based schedule. It only runs when explicitly triggered: manually via sendevent, or by a condition (another job's success/failure) evaluating to true.
When date_conditions is 1, the job has a time-based schedule AND can also have conditions. It runs when its time conditions are met AND its dependency conditions (if any) are all true.
/* Job that ONLY runs via dependency (no time schedule) */ insert_job: downstream_job job_type: CMD command: /scripts/process.sh machine: server01 owner: batch date_conditions: 0 /* no time schedule */ condition: success(upstream_job) /* Job with BOTH a schedule AND a condition */ insert_job: morning_report job_type: CMD command: /scripts/report.sh machine: server01 owner: batch date_conditions: 1 /* time-based scheduling active */ days_of_week: mon-fri start_times: "07:00" condition: success(overnight_etl) /* also waits for ETL to complete */ /* To remove run_calendar and start_times from a job in JIL: */ update_job: morning_report date_conditions: 0 /* disables time scheduling entirely */
run_window — the execution window
run_window defines the hours during which a job is permitted to run. It works differently depending on job type:
For CMD jobs: If the job starts and is still running when the window closes, AutoSys raises a max_run_alarm (if configured) but doesn't automatically kill it — term_run_time does that.
For File Watcher jobs: The watcher only looks for files during the run_window. Outside the window, it won't detect files even if they're present. This is the most important use of run_window.
/* File Watcher: only detects files between 8 AM and 6 PM */ insert_job: watch_for_feed job_type: FW watch_file: /data/feeds/FEED_*.dat watch_interval: 30 min_file_size: 1024 machine: file-server owner: batch run_window: "08:00 - 18:00" /* CMD job: must complete within overnight batch window */ insert_job: nightly_reconcile job_type: CMD command: /scripts/reconcile.sh machine: finance-server owner: batch date_conditions: 1 days_of_week: all start_times: "23:00" run_window: "23:00 - 05:30" /* window for job execution */ term_run_time: 390 /* hard kill after 6.5 hours */
Midnight-spanning windows
run_window windows that span midnight (e.g., "22:00 - 06:00") work correctly in AutoSys — the end time next day is understood automatically. This is common for overnight batch windows.
/* Overnight batch window: 22:00 to 06:00 next day */ insert_job: overnight_batch job_type: BOX date_conditions: 1 days_of_week: mon-fri start_times: "22:00" run_window: "22:00 - 06:00" /* correctly handles midnight crossing */
| Attribute | What it does | Applies to job type |
|---|---|---|
| date_conditions: 0 | No time schedule — condition/manual trigger only | CMD, BOX, FW |
| date_conditions: 1 | Enable start_times/days_of_week/run_calendar | CMD, BOX, FW |
| run_window | Hours during which job can run / FW can detect | CMD (advisory), FW (enforced) |
| term_run_time | Hard-kill job after N minutes | CMD |
🎯 Key Takeaways
- date_conditions is the master switch — must be 1 for start_times, days_of_week, and run_calendar to take effect
- run_window defines when a job is permitted to run — for FW jobs it enforces detection; for CMD jobs it's advisory
- term_run_time is the hard kill for CMD jobs, not run_window
- Set run_window on File Watcher jobs to prevent triggering on stale files outside business hours
⚠ Common Mistakes to Avoid
- ✕Thinking run_window automatically kills a job — for CMD jobs, run_window is advisory; term_run_time is the hard kill
- ✕Not setting run_window on File Watcher jobs — they'll trigger on stale files outside business hours
- ✕Setting date_conditions: 0 on a job that also has start_times — start_times is completely ignored
- ✕Forgetting that update_job to change date_conditions: 0 also disables any run_calendar
Interview Questions on This Topic
- QWhat is the difference between date_conditions and run_window in AutoSys?
- QDoes run_window automatically kill a CMD job when the window closes?
- QHow do you disable time-based scheduling on an existing AutoSys job?
- QWhy is run_window important for File Watcher jobs specifically?
- QHow do you set a run_window that spans midnight?
Frequently Asked Questions
What does date_conditions do in AutoSys?
date_conditions is a flag (0 or 1) that enables or disables time-based scheduling for a job. When set to 0 (the default), the job ignores start_times and days_of_week. When set to 1, the job runs according to its time schedule.
Does run_window kill a job when the window closes?
For CMD jobs, run_window doesn't automatically kill the job — it's advisory. You need term_run_time to hard-kill a job after a specified number of minutes. For File Watcher jobs, run_window prevents the watcher from detecting files outside the specified hours.
How do I disable time-based scheduling on an AutoSys job?
Use update_job to set date_conditions: 0. This disables start_times, days_of_week, and run_calendar. The job will only run when triggered by a condition or manually.
What is the difference between run_window and term_run_time?
run_window defines the hours during which a job is allowed to execute. term_run_time specifies the maximum number of minutes a job can run before AutoSys terminates it. For hard-killing hung jobs, use term_run_time.
Can run_window span midnight in AutoSys?
Yes. Run windows like "22:00 - 06:00" correctly span midnight. AutoSys understands that the end time is the following day. This is standard for overnight batch scheduling.
Developer and founder of TheCodeForge. I built this site because I was tired of tutorials that explain what to type without explaining why it works. Every article here is written to make concepts actually click.