AutoSys Scheduler: Create & Manage Jobs using AutoSys Job Scheduler

AutoSys is used for defining, scheduling and monitoring jobs. These jobs can be a UNIX script, java program or any other program which can be invoked from shell. Before starting we assume that user has already setup an AutoSys environment. This environment consists of autosys server and autosys client.

AutoSys System components

1. Event server (AutoSys database) 2. Event processor 3. Remote agent

Event Server

The event server is a AutoSys database which stores all system information and events as well as all job, monitor, and report definitions. Sometimes this database is also called as a data server, which actually describes a server instance. That is, it is either a UNIX or Windows process, and it is associated data space (or raw disk storage), that can include multiple databases or tablespaces.

Event Processor

This is main component of the autosys system. This processes all the events it reads from dataserver. The event processor is the program, running either as a UNIX process or as a Windows service that actually runs AutoSys. It schedules and starts jobs. When you start the event processor it continually scans the database for events to be processed. When it finds one, it checks whether the event satisfies the starting conditions for any job in the database. [ad#blogs_content_inbetween]

Remote Agent

On a UNIX machine, the remote agent is a temporary process started by the event processor to perform a specific task on a remote (client) machine. On a Windows machine, the remote agent is a Windows service running on a remote (client) machine that is directed by the event processor to perform specific tasks. The remote agent starts the command specified for a given job, sends running and completion information about a task to the event server, then exits. If the remote agent is unable to transfer the information, it waits and tries again until it can successfully communicate with the database.

Basic functionality of AutoSys

Below is the diagram which explains the basic functionality, please check the explanation.

Explanation

1. The event processor scans the event server for the next event to process. If no event is ready, the event processor scans again in five seconds. 2. The event processor reads from the event server that an event is ready. If the event is a STARTJOB event, the job definition and attributes are retrieved from the Event Server, including the command and the pointer (full path name on the client machine) to the profile file to be used for the job. In addition, for jobs running on Windows machines, the event processor retrieves from the database the user IDs and passwords required to run the job on the client machine. 3. The event processor processes the event. If the event is a STARTJOB, the event processor attempts to establish a connection with the remote agent on the client machine, and passes the job attributes to the client machine. The event processor sends a CHANGE_STATUS event marking in the event server that the job is in STARTING state. 4. On a UNIX machine, the inetd invokes the remote agent. On a Windows machine, the remote agent logs onto the machine as the user defined as the job’s owner, using the user IDs and passwords passed to it from the event processor. 5. The remote agent sends an acknowledgment back to the event processor indicating that it has received the job parameters. The socket connection is terminated. At this point, the event processor resumes scanning the event server database, looking for events to process. 6. The remote agent starts a process and executes the command in the job definition. 7. The remote agent issues a CHANGE_STATUS event marking in the event server that the job is in RUNNING state. 8. The client job process runs to completion, then returns an exit code to the remote agent and quits. [ad#blogs_content_inbetween]

Defining autosys job

There are various parameters to define autosys job. Starting from profile, timezone, start time, starting condition and so on. There are the two methods you can use to create job definitions: 1. Using the AutoSys Graphical User Interface (GUI). 2. Using the AutoSys Job Information Language (JIL) through a command-line interface. In this tutorial we will use JIL language to create autosys jobs. JIL stands for Job Information Language. Using this you can instruct autosys to save job definitions. This information saved in autosys database. You can also create a jil file which contains job definition. You can then pass this jil file to autosys. Essential attributes for defining job 1. Job Name JIL Keyword : insert_job. Name used to identify the job. 2. Job Type a. JIL Keyword : job_type. The job type is one of job types: command (c), file watcher (f) or box (b). 3. Owner a. JIL Keyword : owner The job owner specifies whose user ID the command will be run under on the client machine. This attribute is automatically set to the user who invoked jil or the GUI to define the job, and cannot be changed except by the edit superuser. Other job attributes: 1. command: The command attribute can be the name of any command, executable, UNIX shell script or batch file, and its arguments. 2. machine: This attribute specifies the client machine on which the command should be run. 3. date_condition: The start date/time dependencies attribute is a toggle, which specifies whether or not there are date, time, or both, conditions required for starting the job. 4. days_of_week: The days of the week attribute specifies the days on which the job should be run. Sample jil file for command job echoJob.jil
insert_job:echoJob machine:unixMachine owner:username command:echo “Hello this is command job”
Code language: HTML, XML (xml)
To add this job in atosys db. Run following command from unix:
jil < echoJob.jil
Code language: HTML, XML (xml)
This command will add “echoJob” job to autosys databse.

Commands to control the job

Start job command

sendevent –E FORCE_STARTJOB -J <job_name> sendevent -E STARTJOB -J <job_name>
Code language: HTML, XML (xml)

To put jobs on OFF ICE or ON ICE

sendevent -E OFF_ICE -J <job_name> sendevent -E ON_ICE -J <job_name> sendevent -E KILLJOB –J "Job Name Here"
Code language: HTML, XML (xml)

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

Reference

http://supportconnectw.ca.com/public/autosys/infodocs/autosys_cheatsheet.asp

View Comments

  • Autosys is from CA , You will not get any freeware or evaluation edition of autosys. But you have do the autosys features in CRON by writing your own components like autosys.

  • Hi Hanumanth,

    This is a good article. Much appreciated!!

    Could you please let me know if there's any java api which can create & control autosys jobs?

    Thanks,
    Geeya

  • Hi,
    This Site is nice.I am having a doubt..can you please clarify..Actually there is a box job A which is in Success state,and the customer asked to Forcestart the job..As it is been Forcestarted the first job A is in running state,job B is in SU state,job C,D,E are in Active state..can you please explain me why the 3 jobs are in Active state and again as customer ran the jobs manually and asked us to kill the job and mark it as Success...And we did it the 3 jobs C,D,E are in INACTIVE state...can you please clarify my doubt...

    And a suggestion is in your next edition if you can explain about Box Job Logic and the scenarios....It will be very useful to all the people like me......

    Thanks
    Krishna

  • Hi Geeya,

    Sorry I was not able to respond you on time. To answer your qn, if you want to create and manage autosys job there are different ways in my post I have already given different ways. And those are very effective. As per my understanding there is no such java API to create these jobs, but yes you can easily create one API which will read job spec and create autosys job accordingly.

    Hi Krishna,
    When we create a job as a part of Autosys box then the job status heavily depends on box status. If you start a box that will make all of the jobs inside box active that means ready to run. These jobs will start as per their start condition.
    If we take the example that you have given, then job A is in running condition which is force started (assuming A is box name), job B is in status Success because it completed successfully, and remaining jobs C,D,E are in active state because those are part of the Box which is in running state.
    Now when you kill the box the active jobs becomes inactive because they are part of the Autosys box which was killed.

    And remember you cannot change the status of any job to ACTIVE. This is not permitted. Although you can set following status. RUNNING, STARTING, SUCCESS, FAILURE, INACTIVE, and TERMINATED.
    Imp: Changing the status to RUNNING doesn't start the job.

    Hanumant.

  • We had problem with one of our autosys jobs, even though the conditions were met the job did not start. so we forcestarted . Could someone advise what the problem would be.

    Below is the event status:

    Job Name Last Start Last End ST Run Pri/Xit
    ________________________________________________________________ ____________________ ____________________ __ _______ ___

    au_cba_fc04_498_ds_11_pfca_file_flg_chk_f 09/09/2009 00:30:36 09/09/2009 01:57:57 SU 6324888/1

    Status/[Event] Time Ntry ES ProcessTime Machine
    -------------- --------------------- -- -- --------------------- ----------------------------------------
    STARTING 09/09/2009 00:30:27 1 PD 09/09/2009 00:30:36 syd0498
    RUNNING 09/09/2009 00:30:36 1 PD 09/09/2009 00:31:02 syd0498
    [JOB_ON_HOLD] 09/09/2009 01:47:41 0 PD 09/09/2009 01:47:54 syd0498
    [*** ALARM ***]
    JOBNOT_ONICEHOLD 09/09/2009 01:47:53 0 PD 09/09/2009 01:48:01 syd0498

    INACTIVE 09/09/2009 01:49:15 0 PD 09/09/2009 01:49:24
    SUCCESS 09/09/2009 01:57:57 1 PD 09/09/2009 01:58:05
    [JOB_ON_HOLD] 09/09/2009 05:13:19 0 PD 09/09/2009 05:13:35 syd0498
    INACTIVE 09/09/2009 05:14:44 0 PD 09/09/2009 05:14:53
    [JOB_ON_HOLD] 09/10/2009 05:40:31 0 PD 09/10/2009 05:40:39 syd0498
    INACTIVE 09/10/2009 05:42:06 0 PD 09/10/2009 05:42:17
    [FORCE_STARTJOB] 09/10/2009 05:53:00 0 PD 09/10/2009 05:53:08 syd0498

  • Apart from starting conditions does it have any job dependencies . If yes then can you chk if the dependent jobs gone to success if no can you paste the jil over here.

  • Hi

    I have a question regarding mutually exclusive conditions. There are two sets of jobs (around 12 in each set) that need to be run in mutually exclusive mode. Can I define a box for each set and set the condition of not running at the box level?

    Would appreciate a response.

    thx
    Jay

  • Hi,
    I am trying to validate the jil file programmatically. I plan to use the SDK provided by Autosys. Is CA provide any SDK for this?

    Another thing : What is Jil syntax checker or Jil verifier or Jil validator? Where is it available in autosys?

    Regards,
    Siva

  • hi,
    I installed unicentre autosys job management tool.
    But i was enable to create a database while installation.
    I have sql server 2000 sp4 and autosys is 4.5.1 version can you please help me regarding this.

    Thank you

Share
Published by
Hanumant Shikhare
Tags: autosys job scheduling scheduler

Recent Posts

  • Java

Java URL Encoder/Decoder Example

Java URL Encoder/Decoder Example - In this tutorial we will see how to URL encode/decode…

4 years ago
  • General

How to Show Multiple Examples in OpenAPI Spec

Show Multiple Examples in OpenAPI - OpenAPI (aka Swagger) Specifications has become a defecto standard…

4 years ago
  • General

How to Run Local WordPress using Docker

Local WordPress using Docker - Running a local WordPress development environment is crucial for testing…

4 years ago
  • Java

Create and Validate JWT Token in Java using JJWT

1. JWT Token Overview JSON Web Token (JWT) is an open standard defines a compact…

4 years ago
  • Spring Boot

Spring Boot GraphQL Subscription Realtime API

GraphQL Subscription provides a great way of building real-time API. In this tutorial we will…

4 years ago
  • Spring Boot

Spring Boot DynamoDB Integration Test using Testcontainers

1. Overview Spring Boot Webflux DynamoDB Integration tests - In this tutorial we will see…

5 years ago