You are here

AutoSys

AutoSys Tutorials

# Send Event
alias -x se='sendevent -E'

# Start Job
alias -x fsj='sendevent -E FORCE_STARTJOB -J'
alias -x sj='sendevent -E STARTJOB -J'

# Job Report
ar='autorep -w -J '

fsj='sendevent -E FORCE_STARTJOB -J'
hold='sendevent -E JOB_ON_HOLD -J '
ice='sendevent -E JOB_ON_ICE -J '

jd='job_depends -c -w -J '
killjob='sendevent -E KILLJOB -J '
offhold='sendevent -E JOB_OFF_HOLD -J '
office='sendevent -E JOB_OFF_ICE -J '
se='sendevent -E'
sj='sendevent -E STARTJOB -J'
success='sendevent -E CHANGE_STATUS -s SUCCESS -J '
terminate='sendevent -E CHANGE_STATUS -s TERMINATED -J '

Display JIL (Job Instruction Language):
autorep -w -J -q

Load JIL:
jil < JIL_source

Find unique commands currently being used:
autorep -J PARTIALJOBNAME% -q | grep "command:" | awk -F: '{print $2}'|awk '{print $1}' | sort -u > /tmp/cmds.txt

Meaning of AutoSys status:
STATUS AUTOSTATUS Meaning
RU RUNNING Running
ST STARTING Starting
SU SUCCESS Success
FA FAILURE Failure
TE TERMINATED Terminated
OI ON_ICE On Ice
IN INACTIVE Inactive
AC ACTIVATED Activated
RE RESTART Restart
OH ON_HOLD On Hold
QW QUE_WAIT Queue Wait
RD Refresh Dependencies
RF Refresh Filewatcher

Forecast report from date to infinity:
job_depends -t -J ALL -F "mm/dd/yyyy"

Display all jobs scheduled to run between these two dates:
job_depends -t -J ALL -F:06/01/2008 -T:06/30/2008

check if the event procesor is up and running
chk_auto_up

Display list of available timezones:
autotimezone -l

Get version information:
autoflags -a

View Remote Agent log:
autosyslog -J jobname

AutoSys Unix xwindows GUI control panel
autosc &

Check Database connections:
autoping -m machinename -D

Use cron2jil feature. For more info check your manual or just type "man cron2jil" on the command line -- offcourse after setting up your profile.

e.g: if you have a crontab file called file1. Try the following..

>cron2jil -f file1

This will create a file1.jil file in the present directory.

Commands to create virutual machine in AutoSys jobs

To create virutal machine in autosys use below commands, these commands are for unix or sun os. insert_machine: virtual
type: v /* default, not required */
machine: real_1
machine: real_2
max_load: 100
factor: 0.5 /* used to describe the relative processing power of a machine. Usually between 0.0-1.0*/
machine: real_2
max_load: 60 /* this is designed to limit the loading of a machine */ 
 

When not to use the box job in Autosys

The fact that all jobs in a box change status when a box starts running has lead some to use boxes to implement "job cycle" behavior. Be aware that placing jobs in a box to achieve this end may bring with it undesired behavior due to the nature of boxes.

Likewise, you should not place jobs in a box solely because you want to run reports on all of them. When you run autorep on a box, you will get a report on the box and all the jobs in the box (unless you use the -L0 option). In addition, if you use wildcarding when specifying a job name, you could get duplicate entries in your report. For example, suppose you have a box named "acnt_box" containing three jobs named "acnt_job1", "acnt_job2", and "daily_rep". If you specify acnt% as the job name for the autorep report, the report will have an entry for the box "acnt_box" and an entry for each job in the box. Then autorep will continue searching for all job names matching the wildcard characters and, thus, will list "acnt_job1" and "acnt_job2" a second time.

Avoid the temptation to put jobs in a box as a short cut for performing events (such as ON_ICE or ON_HOLD) on a large number of jobs at once. You will most likely find that the default behavior of boxes inhibits the expected execution of the jobs you placed in the box.

Where to go to find the Errors in AutoSys

To find the errors in Autosys use below commands:$AUTOUSER/out/event_demon.$AUTOSERV
($AUTOUSER/out/event_demon.ACE)Output from the job definition output & error files :

  • /tmp files created for job_run at client machine
  • $AUTOSYS/out/DBMaint.out for DB problems
  • $SYBASE/install/errorlog_$DSQUERY when event server will not start.

NT: AutoNuTc\lib/X11\app-defaults\xpertAutoSys Maintenance: DBMaint @$AUTOSYS/binOnce a day the Database goes into a maintenance cycle. Every day at 3:00am default,  it runs a program called DBMaint. This is user configurable. The program runs DBstatistics which is found in $AUTOSYS/bin.app-defaults file: /usr/openwin/lib/app-defaults directory. Autocons, Xpert, etc.. ( or: /usr/lib/X11/app-defaults, /autosys/bin/X11/app-defaults)Environment file: /etc./auto.profile
C programs: $AUTOSYS/code
Where to change AutoSys screen fonts: /usr/openwin/lib/app-defaults
Where to look for troubleshooting: Chapter 15
Summary of commands: Appendix C$AUTO_JOB_NAME: when naming a file dynamically using as prefix AutoSys's job name.
$AUTORUN: unique identifier for the run of that job
$AUTOPID: unique identifier for that job's run number (PID)
$JOID: DB identifier for a job. To extract from the DB: select joid from job where job_name=" "

AutoSys Command Line Commands

Following are the AutoSys command line commands:gatekeeper: Allows you to enter the License Keys which allow you to run AutoSys.eventor [-M machine_name] : Starts the event processor.autorep -J [ALL | Job_name] [-q] [> file_name], -d (detail), -r (run number), -o (override), jil < file_na -G (global var report), -M -q for machine definitions.
Ex: autorep -J job_name -d
    autorep -J job_name -d
    autorep -J job_name -q > file_name queries the DB & save job Dfn. Into a file
      vi file_name
      When you want a report of a box use the -L0 option
      Autorep -J job_name -l1 report on the job for the day -1 (prev day)sendevent -E STARTJOB -J job_name, sendevent -E FORCE_STARTJOB -J job_name, [JOB_ON_ICE, JOB_OFF_ICE, JOB_ON_HOLD, JOB_OFF_HOLD, SET_GLOBAL, STOP_DEMON. . . .]
sendevent -E STOP_DEMON - to stop AutoSys
   (ex: sendevent -E SET_GLOBAL -G "var_name=/home/mydir" to set a var)
   (ex: sendevent -E SET_GLOBAL -G "var_name=DELETE" to delete a var)]chk_auto_up: checks to see if event processor and the DB are both up.autoping -m machine: verify that both client & server are correctly configured.cron2jil -f cronfile [-d outdir] [-I incl_file] [-m machine] [-p prefix]jil <CR>
To insert a job directly into the DB
insert_job: job.id job_type: c
machine: machine_name
command: echo testing jil
[go | ;] (depending on the DB you are using)

Autosys Commands

Autosys is a popular job scheduling tool used in unix used by several organization to manage job automation for running jobs on time accurately and profficiently. Autosys assists system admis to execute jobs and content of the computer safe, if he or she wished. There are several different things that Autosys is capable of doing.

Autosys is mostly used on the Sun OS, Unix operating system. There are three types of jobs for Autosys. The command jobs execute commands, file watcher job watches for the arrival of a specific file, and the box jobs hold other jobs in a "box". The box jobs can organize and control the flow of processes. Although the box can trigger other jobs to run, the box, itself, performs no actions. developers should also realize some specific details about the box jobs. As long as there is a job in a box that is running, the box will not compelete its action. The box will return a status of either success or failure if one or all of the jobs in the box have succeeded or failed. The box job can run indefinitely unless otherwise specified. There are several different commands for Autosys:

AutoSys: UNIX

Cd to the "autouser" ($AUTOUSER) directory and "." (or source) the "ksh" file. Ex: ". ./autosys.ksh.machine" After installing AutoSys, first make sure that the DB is up and running. Check the installation by running the command chk_auto_up to verify connection to the DB and event processor.

Enter the KEYS through "gatekeeper", add keys

Run the "autosys_secure" command to set the AutoSys Edit and Exec Super users (and also to enter NT users/passwords)

Start the Event Processor by running the command "eventor"

Shutdown AutoSys: "sendevent -E STOP_DEMON"

To start the AutoSys GUI set your DISPLAY and run the command "autosc &".
NT: Start AutoSys from start->programs->AutoSys-> administrator ->Graphical User Interface ->Command Prompt

Command Line Commands:

gatekeeper: Allows you to enter the License Keys which allow you to run AutoSys.

eventor [-M machine_name] : Starts the event processor.

autorep -J [ALL | Job_name] [-q] [> file_name], -d (detail), -r (run number), -o (override), jil < file_na -G (global var report), -M -q for machine definitions.
Ex: autorep -J job_name -d
    autorep -J job_name -d
    autorep -J job_name -q > file_name queries the DB & save job Dfn. Into a file
      vi file_name
      When you want a report of a box use the -L0 option
      Autorep -J job_name -l1 report on the job for the day -1 (prev day)

sendevent -E STARTJOB -J job_name, sendevent -E FORCE_STARTJOB -J job_name, [JOB_ON_ICE, JOB_OFF_ICE, JOB_ON_HOLD, JOB_OFF_HOLD, SET_GLOBAL, STOP_DEMON. . . .]
sendevent -E STOP_DEMON - to stop AutoSys
   (ex: sendevent -E SET_GLOBAL -G "var_name=/home/mydir" to set a var)
   (ex: sendevent -E SET_GLOBAL -G "var_name=DELETE" to delete a var)]

chk_auto_up: checks to see if event processor and the DB are both up.

autoping -m machine: verify that both client & server are correctly configured.

cron2jil -f cronfile [-d outdir] [-I incl_file] [-m machine] [-p prefix]

jil <CR>
To insert a job directly into the DB
insert_job: job.id job_type: c
machine: machine_name
command: echo testing jil
[go | ;] (depending on the DB you are using)
Template example:

/* ----------------- template ----------------- */

insert_job: template job_type: c
box_name: box1
command: ls -l
machine: localhost
owner: lyota01@TANT-A01
permission: gx,ge,wx,we,mx,me
date_conditions: 1
days_of_week: all
start_times: "15:00, 14:00"
run_window: "14:00 - 6:00"
condition: s (job1)
description: "description field"
n_retrys: 12
term_run_time: 60
box_terminator: 1
job_terminator: 1
std_out_file: /tmp/std_out
std_err_file: /tmp/std_err
min_run_alarm: 5
max_run_alarm: 10
alarm_if_fail: 1
max_exit_success: 2
chk_files: /tmp 2000
profile: /tmp/.profile
job_load: 25
priority: 1
auto_delete: 12

autosyslog -e: same as tail -f autosys_log_file. This command must be run from the machine where the server resides if used with the -e option. Else it can be used with the -J option to see that job's run log.

job_depends: -[c|d|t] -J jobname [-F "mm/dd/yy time"] [-T "mm/dd/yy time"] (Note: It will only print out the first occurrence found)

monbro -n monitor_name: Allows you to run from command line monitor/browser programs previously created using the monitor/browser GUI.exec superuser: AUTOSYS superuser

autocal_asc full_cal_name: prints, adds & deletes custom calendar definitions.

autostatus: Reports the current status of a specific job, or the value of an AutoSys global variable. Ex: autostatus -J job_name, -S instance

autotimezone -l : Allows additions, deletions, and queries to the timezones table (-l provides list).

autotrack: Tracks & report changes to the AutoSys DB. Ex: autotrack -l 2 (level 2) [sets the tracking level] autotrack -U sys -v (user sys: verbose) To start using the autotrack utility type: autotrack -u to set tracking level 1 or 2. By default it is set to 0. Autotrack -l will list the current tracking level. Options -[J, U, m, F, T, and t] are to request reporting on a specific Job, User, machine, time window (-F -T), and event type (t). Type is used in conjunction w/other parameters. autotrack w/no arguments retrieves information an all events omitting detail. -v option is for verbose.

autosys_secure: to change edit, exec superusers, change DB passwd, change remote authentication method.

chase [-A|E]: Makes sure that jobs claiming to be running in the client machine are running. The "-E" option restarts the job.

archive_events: to archive events in the DB which are older than x days to prev DB from becoming full.

clean_files: Deletes old remote agent log files. It does it by searching the DB for all machines which have had jobs started on them.

autostatad: to get the status of a PeopleSoft job. You can define one of the user definable buttons to view PeopleSoft job: Autocons*userButton1Label: Adapter Status

User definable buttons: There are user definable buttons in the operator's console.

How to configure:

Autocons*userButton1Command: /autosys/bin/autostatad -J $JOB -g & (which allows you to have a command button on the operator's console.)

Dependencies:

success (job) and s(job_b)
failure(job_a) or f (job_b)
notrunning (job)
terminated(job)
exitcode(job) > 5 and exitcode(job_b) != 10
value(global_name)=100
done(job)

Hostscape: Schedule a job to run every x minutes & then go into forecasting. Make that job fail.

Solid black line: Hostscape can communicate with the remote agent in the client machine.

Solid red line: Hostscape can't communicate with the remote agent but it can communicate with the internet daemon (inetd) running on that machine..

Dashed red line: Hostscape can't communicate with the client machine at all. Client is probably down.

Accessing a variable name: $$GLOBAL_VAR_NAME (unless used in dependency condition with a job definition. If used in the "command" field, you must use the $$)

Tunable Parameters:

$AUTOUSER/config.ACE

$AUTOUSER/autosys.ksh.xxx

/etc/auto.profile

/etc/inetd.conf

/etc/services

Notify.Ace: The alarms to notify on are:
(There is an example in $AUTOSYS/install/data/Notify.Ace).

DB_ROLLOVER

DB_PROBLEM

EP_HIGH_AVAILABILITY

EP_ROLLOVER

EP_SHUTDOWN

Where to go to find the Errors:

$AUTOUSER/out/event_demon.$AUTOSERV
($AUTOUSER/out/event_demon.ACE)

Output from the job definition output & error files

/tmp files created for job_run at client machine

$AUTOSYS/out/DBMaint.out for DB problems

$SYBASE/install/errorlog_$DSQUERY when event server will not start.

NT: AutoNuTc\lib/X11\app-defaults\xpert

AutoSys Maintenance: DBMaint @$AUTOSYS/bin

Once a day the Database goes into a maintenance cycle. Every day at 3:00am it runs a program called DBMaint. This is user configurable. The program runs DBstatistics which is found in $AUTOSYS/bin.

app-defaults file: /usr/openwin/lib/app-defaults directory. Autocons, Xpert, etc.. ( or: /usr/lib/X11/app-defaults, /autosys/bin/X11/app-defaults)

Environment file: /etc./auto.profile
C programs: $AUTOSYS/code
Where to change AutoSys screen fonts: /usr/openwin/lib/app-defaults
Where to look for troubleshooting: Chapter 15
Summary of commands: Appendix C

$AUTO_JOB_NAME: when naming a file dynamically using as prefix AutoSys's job name.
$AUTORUN: unique identifier for the run of that job
$AUTOPID: unique identifier for that job's run number (PID)
$JOID: DB identifier for a job. To extract from the DB: select joid from job where job_name=" "

Creating a Virtual Machine:

insert_machine: virtual
type: v /* default, not required */
machine: real_1
machine: real_2
max_load: 100
factor: 0.5 /* used to describe the relative processing power of a machine. Usually between 0.0-1.0*/
machine: real_2
max_load: 60 /* this is designed to limit the loading of a machine */

Load Balancing, Queuing, priorities:

insert_job: test_load
machine: localhost
command: echo "Test load balancing"
job_load: 50
priority: 1 /* this only affects queues */

Note: For 5.0 we will be using information from ServerVision's towards our load balancer which is composed of 26 categories such as i/o usage, disk usage, CPU usage, etc.

Testing:
zql
zql -U autosys -P autosys

NOTES:

When a job is stuck in the starting condition this means that the event processor communicated with the remote agent and passed all the information the remote agent ran the job but was not able to communicate to the DB. Once testing is done with AutoSys one should change the default refresh interval for AutoSys. This is so there is less querying to the DB. When AutoSys goes from dual mode to single mode, always run the autobcp command before bringing AutoSys back to dual mode/High Availability. Default behavior for stdout is to always appends. If you want to overwrite the file enter the following, no spaces: ">file.out"

Box Logic

Use boxes to group jobs with like scheduling parameters, not as means of grouping jobs organizationally. For example, if you have a number of jobs that run daily at 1:00 a.m., you could put all these jobs in a box and assigning a daily start condition to the box. However, a variety of account processing jobs with diverse starting conditions should not be grouped in the same box.

Default Box Job Behavior

Some important rules to remember about boxes are:

Jobs run only once per box execution.
Jobs in a box will start only if the box itself is running.
As long as any job in a box is running, the box remains in RUNNING state; the box cannot complete until all jobs have run.
By default, a box will return a status of SUCCESS only when all the jobs in the box have run and the status of all the jobs is "success." Default SUCCESS is described in Default Box Success and Box Failure on page 5-13.
By default, a box will return a status of FAILURE only when all jobs in the box have run and the status of one or more of the jobs is "failure." Default FAILURE is described in Default Box Success and Box Failure on page 5-13.
Unless otherwise specified, a box will run indefinitely until it reaches a status of SUCCESS or FAILURE. For a description of how to override this behavior, see Box Job Attributes and Terminators on page 5-6.
Changing the state of a box to INACTIVE (via the sendevent command) changes the state of all the jobs in the box to INACTIVE.
When you Should Not Use a Box

The fact that all jobs in a box change status when a box starts running has lead some to use boxes to implement "job cycle" behavior. Be aware that placing jobs in a box to achieve this end may bring with it undesired behavior due to the nature of boxes.

Avoid the temptation to put jobs in a box as a short cut for performing events (such as ON_ICE or ON_HOLD) on a large number of jobs at once. You will most likely find that the default behavior of boxes inhibits the expected execution of the jobs you placed in the box.

Likewise, you should not place jobs in a box solely because you want to run reports on all of them. When you run autorep on a box, you will get a report on the box and all the jobs in the box (unless you use the -L0 option). In addition, if you use wildcarding when specifying a job name, you could get duplicate entries in your report. For example, suppose you have a box named "acnt_box" containing three jobs named "acnt_job1", "acnt_job2", and "daily_rep". If you specify acnt% as the job name for the autorep report, the report will have an entry for the box "acnt_box" and an entry for each job in the box. Then autorep will continue searching for all job names matching the wildcard characters and, thus, will list "acnt_job1" and "acnt_job2" a second time.

What Happens when a Box Runs

As soon as a box starts running, all the jobs in the box (including sub-boxes) change to status ACTIVATED, meaning they are eligible to run. (Because of this, jobs in boxes do not retain their statuses from previous box cycles.) Then each job is analyzed for additional starting conditions. All jobs with no additional starting conditions are started, without any implied ordering or prioritizing. Jobs with additional starting conditions remain in the ACTIVATED state until those additional dependencies have been met. The box remains in the RUNNING state as long as there are activated or running jobs in the box.

If a box is terminated before a job in it was able to start, the status of that job will change directly from ACTIVATED to INACTIVE.

Note o Jobs in a box cannot start unless the box is running. However, once the job starts running, it will continue to run even if the box is later stopped for some reason.

Time Conditions in a Box

Each job in a box will run only once per box execution. Therefore, you should not define more than one time attribute for any job in a box because the job will only run the first time. If you want to put a job in a box, but you also want it to run more than once, you must assign multiple start time conditions to the box itself, and define no time conditions for the job. Remember also that the box must be running before the job can start. Do not assign a start time for a job in a box if the box will not be running at that time. If you do, the next time the box starts the job will start immediately.

The following example illustrates a scenario that would not work properly if placed in a box.

"job_a" is defined to run repeatedly until it succeeds. "job_report" has one starting condition-the success of "job_a".

How Job Status Changes Affect Box Status

If a box that is not running contains a job that changes status, as a result of a FORCE_STARTJOB or CHANGE_STATUS event, the new job status could change the status of its container box. A change of status of the box could trigger the start of downstream jobs that are dependent on the box.

If a box contained only one job, and the job changed status, the box status would change.

AutoSys System Architecture

AutoSys is a job scheduling program for UNIX and Windows NT and is built as event-driven client/server architecture.  

The product architecture consists of three components: 

  • The Event Processor (the AutoSys scheduling process)
  • The Event Server (the AutoSys Oracle database)
  • The Remote agent (the job execution client).

 The Oracle database stores all event and job information.  The Event Processor, the main application of AutoSys, interprets events (reads the events and job descriptions from the database) and based on the job definitions, initiates actions via the Remote Agent to perform specific tasks.  The Remote Agent performs its tasks and sends the resulting job status back to the database.

AutoSys Processing illustration with diagram

>

1. The Event Processor polls the AutoSys Database for the next event to process.  The Event processor will monitor successfully completed events and determine if any predecessors have been met.  If no event is ready, the Event Processor will poll again in 5 seconds.

2. The Event Processor reads one event that is ready from the database.  If the event is a STARTJOB event, the job attributes are retrieved from the database, including the command and the fully qualified program or script to be used for the job.

3. The Event Processor completes the event.  If the event is a STARTJOB, the Event Processor establishes a connection with the Remote Agent on the AutoSys client machine as root via inetd and passes the job attributes to the Remote Agent which is started as autosys.  At this point, the Activated job status will be displayed. 

4.The Event Processor then sends a job status change (STARTING) event to update the database record for the job. At this point, the Starting job status will be displayed.

5. On the AutoSys client, inetd, as root, receives the job request.  The inetd demon invokes the Remote Agent as autosys to process the job (from /etc/inetd.conf file).

6.The Remote Agent sends an acknowledgment back to the Event Processor indicating that it has received the job parameters.  The socket connection is then terminated.

7.The Remote Agent forks a process and executes the command in the job definition to run a local script or job using: execl (sh -c “..”) after sourcing /etc/auto. profile.

8.The Remote Agent sends a job status change (RUNNING) event to update the database using Oracle SQL*NET.  The Running job status will be displayed.

9.The client job process runs to completion, then returns an exit code to the Remote Agent and quits.

10.The Remote Agent sends a job status change (SUCCESSful | FAILURE | TERMINATED) event to update the database, and passes back an exit code using Oracle SQL*NET. The Success (or Failure) job status will be displayed. 

If the remote status is SUCCESSful, the Remote Agent deletes the job log file in the /tmp directory on the AutoSys Client machine.

 The Remote Agent quits and will be started again by inetd when the next event is ready to process.

Benefits of AutoSys scheduler

Scheduling Jobs

Job scheduling typically relies on using the UNIX clock daemon called “cron” or the Windows NT command line interface scheduler service. These utilities are relatively primitive when it comes to scheduling critical production jobs, because they are limited to a single machine; require cryptic instructions in a “crontab” file, and lack of any error-handling, logging, or notification capabilities.

AutoSys provides extensive scheduling functionality. Jobs can be scheduled to run based on time and date, file arrival, and/or job dependencies such as the SUCCESS, FAILURE, or exit code of other jobs. Jobs can also be scheduled to run (or not to run) according to custom calendars you create using the easy-to-use Graphical Calendar Facility. Scheduling power can be applied across multiple platforms anywhere on the network. In addition, AutoSys provides error handling, logging, notification, and a centralized RDBMS for jobs run by any user across the network.

Managing Jobs

One of the most important aspects of implementing a job control scheme is how to monitor the progress (or failure) of multiple jobs across heterogeneous platforms. Jobs may fail in the middle of the night, preventing the receipt of an important report in the morning, causing pagers to go off, signaling the need for human intervention. When multiple, interdependent jobs are scheduled to run, being able to quickly identify and rectify malfunctions is imperative.

AutoSys provides extensive Alarm and Monitor Services that comprehensively monitor every potential point of failure. Should a problem occur, alarms are immediately generated for jobs that encounter processing problems. And, if appropriate, AutoSys automatically takes the necessary actions to correct these problems. Managing jobs is simple using the AutoSys Operator Console, which is designed to provide system-wide control from a single graphical interface.                                                                                         

Intelligent Reporting

Another important aspect of managing job execution is the ability to generate and inspect intelligent reports on the progression of events. All too often, to avoid a “blind” expectation that everything occurred successfully and on time, additional programming must be done to create the necessary report mechanisms for a job control scheme. 

AutoSys provides a suite of reporting utilities that clearly detail the various aspects of job execution. Real-time inspection of job status can be viewed using command line reports or the Operator Console, job dependencies can be listed, and the current state of a job is clearly displayed— regardless of the network machine on which it is being run. 

High Availability and Error-Recovery

System down-time can impede important processing functions, and even stop the time-critical computing that is vital to your business. If and when a “crash” occurs, your hardware and software systems must stay operable and be recoverable. 

AutoSys has engineered recovery and restart capabilities at many levels, from user-defined error recovery to the AutoSys engine itself. If a problem occurs, a job may be restarted, or paging and e-mail notification may be invoked. AutoSys can also run on two machines simultaneously, eliminating a single point-of failure. 

When using “Dual Server Mode,” all information is written to both systems, which are actively mirrored by AutoSys. If an AutoSys component becomes unavailable, AutoSys will perform an unattended rollover to single machine operation, ensuring that jobs will continue processing without interruption. This “High Availability Option” ensures that your jobs will run on time in the event of a machine failure and that jobs will continue processing without interruption.

Autosys Job Handling

Defining Jobs: Can be done through GUI or Job Instruction Language (JIL)

System Components:

  1. Event server: (Autosys Database)
  2. Event Processor: Heart of Autosys Also called event daemon. Schedules and starts jobs. Instructs the remote agent to perform actions.
  3. Remote Agent: A temporary process start by event processor to perform a specific task on client machine. It starts the commands and sends back the status of the job back to event processor

Types of Jobs:

  1. Command Jobs:Can be a shell script or an executable program.
  2. Box Jobs:is a container of other jobs. And is used to organize and control process flow. If no other starting conditions are specified at the job level, a job within a box will run as soon as the starting conditions for the box are satisfied. If several jobs in a box do not have job-level starting conditions, they will all run in parallel.
  3. File watcher:starts a process that monitors for the existence and size of a specific operating system file. When that file reaches a certain minimum size, and is no longer growing in size, the File Watcher Job completes successfully, indicating that the file has arrived.

Job Definition:

The basic Command Job definition has the following required attributes:

Job Name - The unique job identifier by which a job is referenced.

Command -The UNIX shell script, command, or application program to be executed.

Machine Name- The name of the machine on which the command is to be run.

Starting Conditions -The date/time and/or job dependency conditions necessary for the job to be run.

Example:

            days_of_week: mo, we, fr

            start_times: "10:00, 14:00”

Autorep Commands

1)      Autorep

Syntax : autorep -J job_name [ -d | -q | - r run_number ]

Description : autorep lists a variety of information about jobs

Options       :

-J job_name

 Indicates that a Job Report is desired. To report on all jobs, specify ALL. The %    character may be used in the job name as a wildcard

-d   Indicates a Detail Report is desired.

For a Job Report, all events from the last run of the requested job will be listed.

 -q   Indicates a Query Report is desired, providing the current job or machine definition, in JIL format, as it exists in the AutoSys database.

-r run_num

Indicates a report is desired for a specific job run (run_num). This option can only be used with the -s and -d options. If this option is omitted, or run_num is zero, the most current job run is reported. A minus sign (-) can be used before the run_num value to indicate a relative counter for a past job run, relative to the current run number. For example, the option r -2 would generate a report for the job run two runs back.

STATUS codes

Code

Status

AC

Activated

FA

Failure

IN

Inactive

OH

On hold

OI

on ice

QU

Queue wait

RE

Restart

RU

Running

ST

Starting

SU

Success

TE

Terminated

Examples : 

autorep -J pfvw%box%

autorep -J pfvw_d_cmd_mscifeed_proc_1602

autorep -J pfvw_d_cmd_mscifeed_proc_1602 -d

autorep -J pfvw_d_cmd_mscifeed_proc_1602 -q

autorep -J pfvw_d_cmd_mscifeed_proc_1602 - r -2

2)       Job Dependents

Reports information about the dependencies and conditions of a job.

job_depends [-c | -d ] [-J job_name]

Options

-c   Current Condition Status

         Prints out the current state of a job and its job

          dependency conditions (the jobs that are dependent on

          this job).

 -d   Dependencies Only

          Prints out the starting conditions for a job; no indi-

          cation of the current status of the job is provided.

Example :

job_depends -c -J pfvw_d_cmd_mscifeed_proc_1602

3)      Sendevent

Sends events to AutoSys for a variety of purposes, including starting or stopping AutoSys jobs, stopping the Event Processor, and putting a job on hold. To issue a sendevent on a job, you must have execute permis-

sion on that job.

Syntax :

sendevent -E event [ -J job_name] [-s   status]

Options :

-E event

Specifies the event to be sent. This option   is required. Any one of the following values may be specified:

 

STARTJOB- Start the job specified in job_name if the starting conditions are satisfied. That is, a STARTJOB event ignores time and date conditions, but it does not ignore dependencies on other jobs.

KILLJOB- Kill the job specified in job_name. The action depends on one of the job types given below:

Command Jobs- Kills the process that is currently running and all the processes that it has spawned; i.e.,the process group.

Box Jobs- Changes the status to TERMINATED. No more jobs within the box will be started. Jobs that are already running will continue to run to completion.

File Watcher Jobs - Kills the File Watcher job and changes the status to TERMINATED.

DELETEJOB- Delete the job specified in job_name from the database. If job_name is a box, deletes the box and all the jobs in the box.

FORCE_STARTJOB- Start the job specified in job_name, regardless of whether the starting conditions are satisfied or not. Because multiple instances of the same job could be started using this command, we recommended you use the FORCE_STARTJOB event only in extreme situations. Do not force start a job in QUE_WAIT state because jobs in QUE_WAIT state are already started and are waiting for machine resources to become available to run.

JOB_ON_ICE- Puts the job specified in job_name on ice. On  Ice is the functional equivalent of deactivating a job definition. For example, the starting conditions for jobs downstream from JobA, which has been put on ice, will evaluate as shown below.

Evaluation of Dependent Jobs Conditions

Job Condition              

Will Evaluate to

success (JobA)

TRUE

failure (JobA)

FALSE

terminated (JobA)

FALSE

done (JobA)

TRUE

notrunning (JobA)

TRUE

exitcode 

FALSE

 

While a job status is RUNNING or STARTING, AutoSys will not allow the job be put On Ice.

JOB_OFF_ICE- Takes the job specified in job_name Off Ice. This is like reactivating the job description. Jobs that are taken Off Ice will not start until the next time their starting conditions are met.

JOB_ON_HOLD- Puts the job specified in job_name On Hold. When a job is On Hold, it will not be started. A box will not be considered done if a job within it is ON_HOLD, and downstream dependent jobs will not run. If the job is already STARTING or RUNNING, you cannot put it ON_HOLD.

JOB_OFF_HOLD- Takes the job specified in job_name Off Hold. If the starting conditions are met, the job will be started.

CHANGE_STATUS- Forces a change in the status of the job specified in job_name. Ordinarily this should not be used, since AutoSys manages job state changes internally. If this option is selected, the -s status option must also be selected.

STOP_DEMON- Stops the event demon. This is the only way to stop the Event Processor. However, this does not stop the RDBMS(s).

CHANGE_PRIORITY- Takes the -j job_name and the -q priority arguments. Changes the Job Queue Priority of the job to the priority specified. Queue priority is  the relative priority of all jobs in the queue. The lower the number, the higher the priority; zero means to run the job right away. If the job has not been started, priority is changed for the next run only. If the job has been started, and is in a queue, priority is changed immediately.

-s status

Specifies the status to which the job specified in job_name should be changed. This option is used only when the specified event is CHANGE_STATUS,   which requires this option.

These are the valid statuses: RUNNING, STARTING, SUCCESS, FAILURE, INACTIVE, and TERMINATED.

Changing the status to RUNNING does not cause the job to run. It only changes the system's current notion of the status of the job. Therefore, this option should be used with caution. Changing the state of a box to INACTIVE will recursively cause all the jobs in the box to also be changed to INACTIVE.

Examples :

sendevent -E CHANGE_STATUS -J pfvw_d_cmd_mscifeed_proc_1602 -s INACTIVE

sendevent -E CHANGE_STATUS -J pfvw_d_cmd_mscifeed_proc_1602 -s SUCCESS

sendevent -E JOB_ON_HOLD -J pfvw_d_cmd_mscifeed_proc_1602

sendevent -E JOB_OFF_HOLD -J pfvw_d_cmd_mscifeed_proc_1602

sendevent -E JOB_ON_ICE -J pfvw_d_cmd_mscifeed_proc_1602

sendevent -E JOB_OFF_ICE -J pfvw_d_cmd_mscifeed_proc_1602

sendevent -E KILLJOB -J pfvw_d_cmd_mscifeed_proc_1602

sendevent -E FORCE_STARTJOB -J pfvw_d_cmd_mscifeed_proc_1602

sendevent -E CHANGE_STATUS -J -s TERMINATED

Subscribe to AutoSys