JIL insert_job, update_job, and delete_job — Managing AutoSys Jobs
- insert_job creates new jobs; update_job modifies existing ones (partial update only); delete_job removes a single job
- delete_box removes a box AND all its child jobs — use delete_job on the box name to remove only the box while keeping children
- Always back up job definitions with
autorep -J jobname -q > backup.jilbefore making changes
- insert_job creates new job definitions. Fails if the job already exists.
- update_job modifies only the attributes you specify — partial update, not replacement.
- delete_job removes a single job. delete_box removes the box plus all child jobs.
- Each command uses JIL syntax; a typo or missing required attribute stops the entire batch.
- Production insight: delete_box is the most dangerous — it silently wipes entire job trees.
- Biggest mistake: assuming update_job is a full rewrite — it's not, and omitted attributes stay unchanged.
Quick Debug Cheat Sheet: JIL Subcommands
insert_job fails — I don't know why
autorep -J jobname -q | grep -i 'job_type|machine|owner'jil < backup.jil (if backup exists) to compare working syntax.update_job not applying
autorep -J jobname -d | head -5sendevent -E FORCE_STARTJOB -J jobname (if you want to clear a running state)delete_box deleted everything I didn't mean to
ls -la /path/to/backups/*.jil 2>/dev/null || echo 'no backup found'autorep -J boxname -q (if box still partially exists) to reconstruct.Production Incident
autorep -J boxname -q | grep job_name first to see what you're about to delete.Consider renaming delete_box to something less lethal in your runbook — or just ban it in production.Production Debug GuideSymptom → Action for the three most common JIL failures
autorep -J jobname to confirm. Use update_job instead. Never try to delete and re-insert — you'll lose history.autorep -J jobname -d. Running jobs ignore updates until next scheduled start. Also verify you spelled the attribute correctly.autorep -J %keyword% to search. Remember: case-sensitive. Also check global vs local instance.Managing jobs in AutoSys means mastering three JIL subcommands: insert_job to create, update_job to modify, and delete_job to remove. These are the bread-and-butter operations you'll perform every week as an AutoSys administrator or developer. You'll see them in every single batch pipeline. And you'll screw them up at least once.
insert_job — creating a new job
insert_job creates a brand-new job definition in the AutoSys Event Server. The job name must be unique within the instance. All required attributes (job_type, machine for CMD jobs, owner) must be included. You cannot insert_job if a job with that name already exists — use update_job instead.
insert_job: daily_reconcile job_type: CMD command: /opt/scripts/reconcile.sh machine: finance-server-01 owner: finuser date_conditions: 1 days_of_week: mon-fri start_times: "05:00" std_out_file: /logs/autosys/daily_reconcile.out std_err_file: /logs/autosys/daily_reconcile.err alarm_if_fail: 1 n_retrys: 1 description: "Morning reconciliation run before market open"
autorep -J newjob -q after insertion — a silent failure (like a typo in machine name) can leave the job orphaned.update_job — modifying an existing job
update_job modifies an existing job definition. You only need to include the attributes you want to change — everything else stays as it was. This is a partial update, not a full replacement.
/* Change only the start time — everything else unchanged */ update_job: daily_reconcile start_times: "04:30" /* Add a condition to an existing job */ update_job: generate_report condition: success(daily_reconcile) /* Change the machine a job runs on */ update_job: daily_reconcile machine: finance-server-02
start_times: "").delete_job and delete_box
delete_job removes a single job. delete_box removes a box and ALL jobs inside it. Always back up definitions before deleting.
/* Delete a single job */ delete_job: old_report_job /* Delete a box AND all inner jobs */ delete_box: legacy_eod_box /* SAFER: backup first, then delete */ # autorep -J old_report_job -q > /tmp/old_report_job_backup.jil # Then review the backup, then: delete_job: old_report_job
/* AutoSys/JIL: Successfully deleted box: legacy_eod_box (5 jobs removed) */
autorep -J jobname -q > backup.jil before any delete operation. Once a job is deleted from the Event Server, the history is also gone.Common pitfalls when using JIL subcommands
Even experienced AutoSys admins make mistakes with these commands. The most common: confusing insert and update, forgetting that update is partial, running delete_box when you meant delete_job, and not backing up before deletion. Also: JIL syntax is finicky about whitespace. A missing colon after the subcommand attribute name will cause a parse error.
/* WRONG: missing colon after job name */ update_job daily_reconcile /* WRONG: using insert_job on an existing job */ insert_job: daily_reconcile /* WRONG: trying to remove start_times by omitting it */ update_job: daily_reconcile /* Oops — start_times not mentioned, so it stays at 05:00 */
ERROR: job daily_reconcile already exists — use update_job
(No error update_job silently does nothing for start_times) */
- POST (insert_job) fails if resource exists.
- PATCH (update_job) only changes included fields.
- DELETE (delete_job) removes one resource.
- Cascading DELETE (delete_box) removes a collection and all its children.
Automating job lifecycle management with scripts
In production, you'll rarely run JIL commands one by one. Instead, you'll build scripts that generate JIL files dynamically and pipe them to the jil command. A common pattern: loop over a list of jobs, check existence, then choose insert or update. Another: after a code deployment, you update batch schedules en masse by generating JIL from a template.
#!/bin/bash # Example: deploy new job or update existing JOB_NAME="daily_reconcile" JIL_FILE="/tmp/${JOB_NAME}.jil" # Check if job exists autorep -J "$JOB_NAME" -q > /dev/null 2>&1 if [ $? -eq 0 ]; then echo "Job exists — using update_job" cat > "$JIL_FILE" <<EOF update_job: $JOB_NAME start_times: "06:00" EOF else echo "Job does not exist — using insert_job" cat > "$JIL_FILE" <<EOF insert_job: $JOB_NAME job_type: CMD command: /scripts/run.sh machine: prod-server owner: batuser start_times: "06:00" EOF fi jil < "$JIL_FILE"
/* AutoSys/JIL: Successfully updated job: daily_reconcile */
| Subcommand | Creates? | Modifies? | Full replacement? | Deletes? |
|---|---|---|---|---|
| insert_job | Yes — new only | No — fails if exists | N/A | No |
| update_job | No — fails if not exists | Yes — partial update | No — only changed attrs | No |
| delete_job | No | No | No | Job only |
| delete_box | No | No | No | Box + all children |
🎯 Key Takeaways
- insert_job creates new jobs; update_job modifies existing ones (partial update only); delete_job removes a single job
- delete_box removes a box AND all its child jobs — use delete_job on the box name to remove only the box while keeping children
- Always back up job definitions with
autorep -J jobname -q > backup.jilbefore making changes - update_job only requires the attributes you want to change — omitted attributes keep their current values
- Never trust the 'success' message from JIL — always verify with autorep -q after every operation
- Automate JIL operations with scripts that check job existence before choosing insert vs update
⚠ Common Mistakes to Avoid
Interview Questions on This Topic
- QWhat is the difference between insert_job and update_job?JuniorReveal
- QIf you want to delete a box but keep its inner jobs, which command do you use?Mid-levelReveal
- QHow do you back up an AutoSys job definition before modifying it?JuniorReveal
- QCan you use update_job on a job that doesn't exist yet?JuniorReveal
- QWhat happens to history when you delete an AutoSys job?Mid-levelReveal
- QHow do you handle a situation where an update_job doesn't seem to apply?SeniorReveal
Frequently Asked Questions
Can you use insert_job to update an existing AutoSys job?
No. insert_job will fail if a job with that name already exists. Use update_job to modify an existing job.
Does update_job require all attributes?
No. update_job is a partial update — you only specify the attributes you want to change. All other attributes keep their current values.
What is the difference between delete_job and delete_box?
delete_job removes a single job. When used on a box, it removes only the box — the inner jobs become standalone. delete_box removes the box AND all inner jobs in one operation.
How do I recover a deleted AutoSys job?
If you took a backup with autorep -J jobname -q > backup.jil before deleting, you can re-insert it with jil < backup.jil. Without a backup, the job definition is gone.
Can I rename an AutoSys job?
Not directly. AutoSys doesn't have a rename command. To rename a job, export the definition with autorep -q, modify the job name in the JIL file, insert the new version with insert_job, then delete the old one with delete_job.
What happens if I forget a colon in a JIL attribute line?
The JIL parser will likely fail to parse the line, and the entire batch will abort with a syntax error. Always use the syntax attribute: value exactly.
Can I run JIL commands directly on the command line without a file?
Yes, you can pipe JIL commands directly to the jil command, e.g., echo "delete_job: oldjob" | jil. But it's safer to use a file for multi-line batches.
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.