Professional Documents
Culture Documents
Syed Mohani
INVESTMENT BANK TECHNOLOGY
Agenda / Topics to be Covered
Topics:-
----------------------------------
--- What is autosys how it works
--- How to check Autosys is running.
--- Jil (Job Information Language)
--- How to setup a new/delete/upgrade Jobs
--- Autosys vs Cron jobs
--- Common commands used (Operate Prospective)
--- Automatic conversion from Cron jobs to Autosys jobs
--- Changes from Solaris to Linux Environment AutoSys jobs
INVESTMENT BANK TECHNOLOGY
2
What is Autosys
AutoSys is an automated job management system that lets operate schedule, monitor and report.
Using Autosys utilities, we can define a job by assigning it a name and specifying the arrributes
that describe its associated behavior.
3
Software Components
From a software perspective, the AutoSys environment is composed these main components:-
--- Event Server (Autosys Database)
--- Event Processor
--- Remote Agent
INVESTMENT BANK TECHNOLOGY
4
Jobs Types
5
Jobs Types
6
AutoSys Commands and Monitors
There are several commands unique to AutoSys that can be used to control, configure, and
report on the system behavior.
7
AutoSys Job Definition
8
AutoSys Job Definition
A job performs a particular action based on a set of instructions called a job definition.
Starting Conditions:
--- Data and time condition
--- days_of_week
--- start_times
--- run_window
--- Job dependency conditions
--- success(job_name)
--- failure(job_name)
INVESTMENT BANK TECHNOLOGY
--- notrunning(job_name)
--- done(job_name)
9
Job Status
At every point in processing, a job has what is called its current status or “state”.
--- STARTING ST (The job is in the process of ‘coming up”)
--- RUNNING RU (The job is running)
--- INACTIVE IN (Job has not been processed, has never been run)
--- SUCCESS SU (Exit code equal)
--- FAILURE FA (Job exited with an exit code)
--- TERMINATED TE (Job terminated while in the RUNNING state)
--- RESTARTED RE (Job was unable to start (or failed) and schedule to restart)
--- ACTIVATED AC (Job is itself has not yet started.)
--- ON_ICE OI (Job is removed from all conditions and logic, but is still defined.
INVESTMENT BANK TECHNOLOGY
satisfied. This job will not run until its starting conditions reoccur.
10
Common Commands
# autorep -j %lmc%
Job Name Last Start Last End ST Run Pri/Xit
Syntax
autorep {-J job_name -M machine_name -G global_name} [-s -d -q -o over_num] [-r run_num]
INVESTMENT BANK TECHNOLOGY
11
Common Commands
12
Common Commands
13
Common Commands
14
Common Commands
15
Common Commands
To specify that the jobs can be run on any day except those days specified in the <name-
holidays> calendar.
exclude_calendar : <name-hoilidays>
Sendevent:-
16
Common Commands
Logs:-
# autosyslog -e -J <job-name>
INVESTMENT BANK TECHNOLOGY
17
SendEvents Options
18
SendEvents Options
Sendevents to AutoSys for a variety of purposes, including starting or stopping AutoSys jobs,
stopping the Event processor, and putting a job on hold. This command is also used to set AutoSys
global variables or cancel a scheduled event. sendevent is normally used with "-E" & -J option
-J job_name : Specifies the name of the job to which the specified event should be sent.
-E event :Specifies the event to be sent. This option is required. Any one of the following events
may be specified as:
STARTJOB
KILLJOB
DELETEJOB
FORCE_STARTJOB
INVESTMENT BANK TECHNOLOGY
JOB_ON_ICE
JOB_OFF_ICE
JOB_ON_HOLD
JOB_OFF_HOLD
CHANGE_STATUS
STOP_DEMON
CHANGE_PRIORITY
COMMENT
ALARM
SET_GLOBAL
SEND_SIGNAL
19
Command Attributes
AUTOREP
20
Job Physical loaction
# pwd
/cri_staging/syed/jil/lmc
*** 2193 smccuatcriwa06 citwl:ugcrmcit /cri_staging/syed/jil/lmc
# ls -altr
total 20
drwxr-xr-x 3 citwl ugcrmcit 4096 Apr 13 17:27 ..
-rwxr-xr-x 1 citwl ugcrmcit 423 Apr 13 18:31 uat_lmc_live_rate_Dly.bak
-rwxr-xr-x 1 citwl ugcrmcit 423 Apr 14 11:42 uat_lmc_live_rate_Dly.jil.20100414
-rwxrwxrwx 1 citwl ugcrmcit 395 Apr 14 12:07 uat_lmc_live_rate_Dly.jil
INVESTMENT BANK TECHNOLOGY
21
Jobs Streams
A job stream (or Flow) refers to the logic of how related AutoSys jobs are run.
---- Date and Time conditions
---- Job dependency conditions
lob_backup Command job has date and time condition (Runs every day of the week at 01:01 am
Job_clean Command job has a job dependency condition specified for its starting parameters.
It will run only on the successful completions of job_backup.
INVESTMENT BANK TECHNOLOGY
22
Jobs Streams
23
Defining and Running jobs using Job Information Language (JIL)
We can use AutoSys proprietary scripting language --- JIL to create jobs
definitions. This job definition must be submitted to the AutoSys database
before the job can be run.
JIL Sub-Commands:-
--- insert_job
--- update_job
--- delete_job
24
JIL Syntax
Example:-
Creating a job:
vi <test-for-autosys-job-creation.jil>
# JIL Script
# This script will re-direct a message to the file /tmp/test-output.out
update_job: test-for-autosys-job-creation job_type: c
machine: cri_batch_job_queue
INVESTMENT BANK TECHNOLOGY
permission: gx,wx,mx
command: /bin/echo "AutoSys KT demo" > /cri_staging/syed/jil/demo/test-output.out
std_out_file: /cri_staging/syed/jil/demo/test-output.out
Saving a job:
Jil < test-for-autosys-job-creation.jil
25
Jobs Details
# autorep -j uat_lmc_live_rate_Dly -q
/* ----------------- uat_lmc_live_rate_Dly ----------------- */
insert_job: uat_lmc_live_rate_Dly job_type: c
command: /apps/ss/userprojects/lmc/live_rate.sh
machine: cri_web_job_queue
owner: citwl@smccuatcriwa06
permission: gx,wx,mx
date_conditions: 1
days_of_week: mo,tu,we,th,fr
start_times: "22:00"
INVESTMENT BANK TECHNOLOGY
26
JIL Syntax
Delete a Job:
At the unix Command Prompt
# jil <enter-key>
27
Job Delete thru jil:-
Delete the Job:-
Step 1 --- Vi the jil file and replace command with delete_job:
machine: snjprdcria1.jpmchase.com
#owner: capbg@snjprdcria1.jpmchase.com
permission: gx,ge,wx
condition: success(prd_cit_cap_CPPfile_fwatch)
std_out_file: /home/capbg/scripts/CPP_month.stdout
std_err_file: /home/capbg/scripts/CPP_month.stderr
alarm_if_fail: 1
28
Auto Transfer Cronjobs into Autosys jobs
Commands:-
cron2jil - Translates crontab files into JIL format
cron2jil -f crontab_file [-d output_directory] [-i include_file] [-m machine] [-p prefix]
autocal_asc -lc
List the cycle calendar
Note:
cron2jil does not generate JIL files for jobs that are defined in crontab to start every minute
After the *.jil or *.cal files are generated, you must submit them to the database using the
jil and the autocal_asc commands, respectively.
29
Auto Transfer Cronjobs into Autosys jobs
Combing Calendars:-
Calendars can be combined in a number of ways. For expample, we can create a calendar
that includes all the dates that are in either one calendar or another.
We can import calendar text files. Calendars contained in ASCII test files can be imported
Into AutoSys database. These test files may contain multiple calendars, each of which must
be delimited with the calendar: Calendar_name attributes.
calendar: Q1paydays
01/01/2010
01/15/2010
02/01/2010
02/15/2010
INVESTMENT BANK TECHNOLOGY
03/01/2010
06/15/2010
calendar: Q1holidays
01/01/2010
30
Auto Transfer Cronjobs into Autosys jobs
Date Range:-
The following resource sets the number of years in the data range of the calendar, as a
default at start up. This can be overridden manually by way of the Date Range option from
the options menu.
31
New Setup for Linux Environment
32
AutoSys Jobs naming convention
Env-App-JobName
XX-XXXXX-XXXXXXXXXXXXXXXXXXX
XX = [DR/ST/QA/UT/PR]
XXXXX = [CMART/CAPLO/BASEL/IBFTP/……]
XXXXXXXXXXXXXXXXXXXX = JOB Name
INVESTMENT BANK TECHNOLOGY
33
AutoSys vs CronJob
max_run_alarm: <mins>
Specifies the max run time that a job should require to finish normally. This test
can catch an error. Such as the applications stuck in a loop.
n_retrys: 5
To set the job to be automatically restarted up to five times after an application
Failure.
Priority: 1
Set the job priority for run.
run_calender: <calendar-name>
Running job on the last business day of the every month.
INVESTMENT BANK TECHNOLOGY
Run_window: <time-time>
Before starting the job autosys will check the window time.
watch_file: <path>
Attributes used as Watch file min file size and watch interval
34
INVESTMENT BANK TECHNOLOGY Q&A
35