AutoSys Job Types — CMD, BOX, and File Watcher Explained
- AutoSys has three native job types: CMD (runs a command), BOX (container that controls child jobs), and FW File Watcher (watches for file arrival)
- BOX jobs don't execute commands — they group jobs together and their status reflects the aggregate outcome of all inner jobs
- Child jobs are linked to a BOX with the box_name attribute; without it they run independently
- CMD jobs execute commands or scripts on a target machine. Exit code 0 = success.
- BOX jobs are containers that control when child jobs run. They don't execute anything.
- File Watcher jobs watch for file arrival and trigger dependent jobs.
- Performance: File Watcher polls every 30-60 seconds — set watch_interval to balance latency vs load.
- Production insight: Box jobs fail if any child fails — know the ripple effect before building deep hierarchies.
- Biggest mistake: Using depends_on without a healthcheck in Docker, but here it's forgetting box_name on child CMD jobs.
Quick Debug Commands for Job Types
Job stuck in ACTIVATED/STARTING
ping <machine>autorep -q <job> -w | grep -i statusFile Watcher not detecting file
ls -la /path/to/fileautorep -q watch_job -w | grep watch_fileBox job bypasses children
autorep -q <box_name> -wautorep -q <box_name> -w 2>&1 | grep -i "job_name"CMD job shows SUCCESS but no output file
cat <std_out_file>cat <std_err_file>Production Incident
Production Debug GuideSymptom to action guide for CMD, BOX, and File Watcher failures
Every job in AutoSys has a job_type attribute that determines its fundamental behaviour. There are only three native job types, and understanding what each one does — and more importantly when to use each — is essential for building effective AutoSys workflows.
In practice, most AutoSys environments are built from a combination of all three types working together: BOX jobs contain CMD jobs, and File Watcher jobs trigger other jobs when files arrive.
CMD — the command job
CMD (or just 'c' in JIL shorthand) is the most common job type. It executes a command, script, or program on a specified machine.
The job runs as the specified owner user on the machine. Whatever exit code the command returns determines the job status: exit code 0 means SUCCESS, any non-zero exit code means FAILURE.
- Shell scripts
- Python or Perl scripts
- Java programs invoked from command line
- Database scripts called via sqlplus, psql, or similar
- Any executable that can be called from a command line
/* ── Simple shell script job ── */ insert_job: run_etl_extract job_type: CMD command: /opt/scripts/etl/extract_data.sh machine: etl-server-01 owner: etluser date_conditions: 1 days_of_week: all start_times: "23:00" std_out_file: /logs/autosys/run_etl_extract.out std_err_file: /logs/autosys/run_etl_extract.err alarm_if_fail: 1 n_retrys: 1 term_run_time: 120 /* ── Python script job with arguments ── */ insert_job: generate_risk_report job_type: CMD command: "/usr/bin/python3 /opt/reports/risk_report.py --date $(date +%Y%m%d)" machine: report-server-01 owner: reportuser condition: success(run_etl_extract) alarm_if_fail: 1
/* CMD job exits non-zero → status becomes FAILURE → alarm fires */
BOX — the container job
A BOX job is a container that holds other jobs (including other BOX jobs). The BOX itself doesn't execute any command — it controls when the jobs inside it can start.
- Jobs inside a box will only run if the box is in RUNNING state
- The box enters RUNNING state when its own start conditions are met
- The box moves to SUCCESS only when ALL inner jobs have succeeded
- The box moves to FAILURE if any inner job fails
- If you put a box inside another box, the parent box must be RUNNING for the inner box to run
BOX jobs are how you group related batch processes together. A typical end-of-day processing flow might have one parent box containing several child boxes, each of which contains the actual CMD jobs.
/* ── Parent BOX: controls when the whole flow runs ── */ insert_job: eod_processing_box job_type: BOX date_conditions: 1 days_of_week: mon-fri /* business days only */ start_times: "22:00" alarm_if_fail: 1 description: "End-of-day batch processing — runs all ETL and reports" /* ── CMD jobs INSIDE the box ── */ insert_job: eod_extract job_type: CMD box_name: eod_processing_box /* this links it to the parent box */ command: /opt/scripts/eod_extract.sh machine: etl-server-01 owner: batchuser insert_job: eod_transform job_type: CMD box_name: eod_processing_box command: /opt/scripts/eod_transform.sh machine: etl-server-01 owner: batchuser condition: success(eod_extract) /* waits for extract to succeed */ insert_job: eod_load job_type: CMD box_name: eod_processing_box command: /opt/scripts/eod_load.sh machine: etl-server-01 owner: batchuser condition: success(eod_transform)
22:00 — eod_processing_box starts (RUNNING)
22:00 — eod_extract starts immediately (no condition)
22:08 — eod_extract succeeds → eod_transform starts
22:25 — eod_transform succeeds → eod_load starts
22:40 — eod_load succeeds → box moves to SUCCESS */
File Watcher — the event-driven trigger
A File Watcher job does exactly what the name says: it watches for a file on a machine. When the file appears (and optionally reaches a minimum size, indicating it's finished being written), the File Watcher job completes with SUCCESS, which then triggers dependent CMD jobs.
File Watcher jobs are essential in integration scenarios where an upstream system drops a file that downstream processing depends on. Instead of scheduling the downstream job at a fixed time and hoping the file is there, you let the File Watcher trigger it the moment the file actually arrives.
watch_file— the full path and filename to watch for (supports wildcards)watch_interval— how often to check (in seconds, default 60)min_file_size— minimum file size in bytes before declaring successwatch_file_min_size— same as above, alternate attribute name
/* ── File Watcher: wait for upstream file ── */ insert_job: watch_for_trades_file job_type: FW /* FW = File Watcher */ watch_file: /data/inbound/trades_*.csv watch_interval: 30 /* check every 30 seconds */ min_file_size: 1024 /* must be at least 1 KB */ machine: data-landing-server owner: batchuser date_conditions: 1 days_of_week: mon-fri run_window: "08:00 - 20:00" /* only watch during business hours */ alarm_if_fail: 1 description: "Watches for daily trades file from upstream system" /* ── CMD job that runs after file arrives ── */ insert_job: process_trades_file job_type: CMD command: /opt/scripts/process_trades.sh machine: processing-server-01 owner: batchuser condition: success(watch_for_trades_file) /* triggers when file found */ alarm_if_fail: 1
09:47:32 — watch_for_trades_file: SUCCESS
09:47:33 — process_trades_file: starting (condition met) */
Choosing the Right Job Type for the Task
While the three job types serve distinct purposes, real workflows blend them. Guidance:
- Use CMD for any executable work. This is your default job type.
- Use BOX to group jobs that must complete together before something else runs. A box ensures atomicity of a batch step.
- Use File Watcher when processing depends on external file arrival. Do not use a fixed schedule if arrival time is unpredictable.
- Avoid using BOX as a simple scheduler — use date_conditions on individual jobs if you don't need container semantics.
- Consider FW inside a BOX to start a batch sequence when a file arrives — the FW succeeds, then triggers the downstream CMD inside the same box.
- If the work is a script or program → CMD
- If you need to control a group of jobs as a unit → BOX
- If the start signal is an external file → File Watcher
- If you need all three → nested BOX containing FW and CMD tasks
Job Type Limitations and Gotchas
Each job type has constraints that bite in production:
- CMD jobs cannot be inside a box without box_name attribute. Missing it means the job runs independently.
- BOX jobs cannot have a machine attribute — they don't execute commands. Adding one is harmless but confusing.
- File Watcher jobs only watch one directory/pattern at a time. To watch multiple patterns, create multiple FW jobs.
- File Watcher jobs succeed once. To re-trigger on a new file each day, you need date_conditions and a run_window.
- BOX jobs with many children can take a long time to report final status because it awaits all children. Use alarms to detect partial failures early.
| Job Type | JIL code | Does it execute a command? | Best used for |
|---|---|---|---|
| CMD | CMD or c | Yes — runs the command attribute | Shell scripts, programs, database calls |
| BOX | BOX or b | No — container only | Grouping related jobs, controlling batch flow timing |
| File Watcher | FW or f | No — watches for file | Event-driven triggers based on file arrival |
🎯 Key Takeaways
- AutoSys has three native job types: CMD (runs a command), BOX (container that controls child jobs), and FW File Watcher (watches for file arrival)
- BOX jobs don't execute commands — they group jobs together and their status reflects the aggregate outcome of all inner jobs
- Child jobs are linked to a BOX with the box_name attribute; without it they run independently
- File Watcher jobs are the right pattern for event-driven integration scenarios where processing should start when a file arrives, not at a fixed time
- Always set alarm_if_fail on jobs that have external dependencies — silent failures are the worst
- Minimal job type usage: only use BOX when you need to group, only use FW when file arrival is the trigger
⚠ Common Mistakes to Avoid
Interview Questions on This Topic
- QWhat are the three job types in AutoSys?JuniorReveal
- QWhat is a BOX job in AutoSys and what does it do?JuniorReveal
- QWhat is a File Watcher job and when would you use one?Mid-levelReveal
- QIf a BOX job is in RUNNING state but inner CMD jobs aren't starting, what would you check?SeniorReveal
- QWhat attribute links a CMD job to its parent BOX job?JuniorReveal
- QCan you put a File Watcher job inside a BOX job? What's a real use case?SeniorReveal
Frequently Asked Questions
What are the three types of jobs in AutoSys?
The three job types are: CMD (command job — executes a command or script), BOX (container job — groups other jobs and controls their scheduling), and FW (File Watcher — watches for a file to appear and triggers dependent jobs when it does).
Does a BOX job need a machine attribute?
No. BOX jobs don't execute any command, so they don't need a machine. Only CMD and File Watcher jobs need a machine specified.
What happens to inner jobs if a BOX job fails?
If a BOX job fails (because one of its inner jobs failed), the remaining inner jobs that haven't started yet will not start. The box stays in FAILURE state. You need to fix the underlying issue and then restart or force-start the box.
How does a File Watcher job know the file has finished being written?
The min_file_size attribute is your safeguard. The File Watcher won't declare SUCCESS until the file is at least the specified size in bytes. Set this to larger than an empty or incomplete file would be to avoid premature triggering.
Can a BOX job contain other BOX jobs?
Yes. You can nest boxes inside boxes to create hierarchical batch workflows. The outer box controls the overall schedule, inner boxes group related jobs, and CMD jobs do the actual work. This nesting can go multiple levels deep.
How do I make a File Watcher job trigger multiple times per day?
By default, a FW job succeeds once and stays in SUCCESS. To trigger multiple times, you need date_conditions and a run_window. When the run window ends, the job resets to INACTIVE. Next day, if the run window is open, it starts watching again. For multiple triggers within a single day, you need a different approach — e.g., separate FW jobs for each expected file.
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.