Autosys commands

Thursday, December 05, 2013

QA



I need to know the list of autosys job that run between given time.

I have the following command.

Code:
job_depends -t -J abc% -F  "12/25/2010 03:00" -T  "12/26/2010 05:00"

Above command will give the list of job that run between time 3 AM and 5 AM.

But the it gives me in random order how to order it either ASC or DESC order?

Basic of AutoSys

Qs : What is Autosys ?

Unicenter AutoSys JM is an automated job control system for scheduling, monitoring, and reporting. These jobs can reside on any Unicenter AutoSys JM -configured machine that is attached to a network.

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.


Qs: What are the sysetm components in Autosys?

 

AutoSys System components:

1. Event server 
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.

 

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.
  4. The event processor sends a CHANGE_STATUS event marking in the event server that the job is in STARTING state.
  5. 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.
  6. 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.
  7. The remote agent starts a process and executes the command in the job definition.
  8. The remote agent issues a CHANGE_STATUS event marking in the event server that the job is in RUNNING state.
  9. The client job process runs to completion, then returns an exit code to the remote agent and quits.

 

Qs : In how many ways we can define Autosys jobs?



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:
  • Using the AutoSys Graphical User Interface (GUI).
  • 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.


Qs: What are the job attributes and their JIL keyword in Autosys? Give some examples.


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.

4. command: The command attribute can be the name of any command, executable, UNIX shell script or batch file, and its arguments.

5. machine: This attribute specifies the client machine on which the command should be run.

6. date_condition: If the date_condition is set to 1 (True), which specifies there are date, time, or both, conditions required for starting the job.

7. days_of_week: The days of the week attribute specifies the days on which the job should be run. Starting 2 letters for the day's name are used as the value. we can use 'all' if job is going to run everyday.

8. start_times: Give the time in 24 hours format when job is going to start running.

9. description: Give some job information as comment.

10. std_out_file: it is a standard output log where you can save the job run log.

11. std_err_file: it is a standard error log where you can save the run time error log.

12. alarm_if_fail: if this attribute is set with value 1, user will be notified when job fails.

 

Example :


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"
description: "Live Rate Job"
std_out_file: /local/ss/cit/userprojects/log/lmc/lmc_liverate.stdout 
std_err_file: /local/ss/cit/userprojects/log/lmc/lmc_liverate.stderr 
alarm_if_fail: 1


Qs: How to add job definition to JIL library? How to schedule jobs in Autosys?


Job definition using JIL code as given above and
the below command will add “echoJob” job to autosys databse.


jil < jobname.jil


Qs: What are the differnent job Status in Autosys ?

 

STATUS on output screen 

(abbreviated with starting 2 letters)

ACTUAL STATUS               

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












Autosys Job Management



Autosys Job Management for UNIX


This guide will be helpfull in giving basic idea about what autosys is, defining jobs to AutoSys, monitoring and managing jobs.


Introduction to Autosys:  

  • AutoSys is an automated job control system for scheduling, monitoring, and reporting. 
  •  These jobs can reside on any AutoSys-configured machine that is attached to a network.
  • An AutoSys job is any single command, executable, script, or Windows batch file. 
  • Each AutoSys job definition contains a variety of qualifying attributes, including the conditions specifying when and where a job should be run.

Defining Jobs :


There are the two methods you can use to create job definitions:


  • Using the AutoSys Graphical User Interface (GUI).
  • Using the AutoSys Job Information Language (JIL) through a command-line interface.


Autosys Jobs: 

There are three types of jobs: 

  • command job
  • file watcher job
  • box job

As their names imply, command jobs execute commands 

Box jobs are containers that hold other jobs (including other boxes), 

File watcher jobs watch for the arrival of a specified file. 

In the AutoSys environment, the box job (or box) is a container of other jobs. A box job can be used to organize and control process flow. The box itself performs no actions, although it can trigger other jobs to run. An important feature of this type of job is that boxes can be put inside of other boxes.


Default Box Job Behavior:
 

Some important rules to remember about boxes are
  1. Jobs run only once per box execution.
  2. Jobs in a box will start only if the box itself is running.
  3. 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.
  4. 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".
  5. 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".
  6. Unless otherwise specified, a box will run indefinitely until it reaches a status of SUCCESS or FAILURE.
  7. Changing the state of a box to INACTIVE (via the sendevent command) changes the state of all the jobs in the box to INACTIVE.


Job States and Status :


  • AutoSys keeps track of the current state, or status, of every job. 
  • The value of a job’s status is used to determine when to start other jobs that are dependent on the job. 
  • The job status is displayed in the job report generated by the autorep command, and in the job report you can view in the Job Activity Console. 
 
Following are the status of Autosys jobs:

  1. INACTIVE : The job has not yet been processed. Either the job has never been run, or its status was intentionally altered to “turn off” its previous completion status 
  2. ACTIVATED :The top-level box that this job is in is now in the RUNNING state, but the job itself has not started yet.
  3. STARTING : The event processor has initiated the start job procedure with the Remote Agent.
  4. RUNNING : The job is running. If the job is a box job, this value simply means that the jobs within the box may be started (other conditions permitting). If it is a command or file watcher job, the value means that the process is actually running on the remote machine.
  5. SUCCESS : The job exited with an exit code equal to or less than the “maximum exit code for success.” By default, only the exit code “0” is interpreted as “success.” If the job is a box job, this value means that all the jobs within the box have finished with the status SUCCESS (the default), or the “Exit Condition for Box Success” evaluated to true
  6. FAILURE : The job exited with an exit code greater than the “maximum exit code for success.” By default, any number greater than zero is interpreted as “failure.” AutoSys issues an alarm if a job fails
  7. TERMINATED : The job terminated while in the RUNNING state. A job can be terminated if a user sends a KILLJOB event or if it was defined to terminate if the box it is in failed. If the job itself fails, it has a FAILURE status, not a TERMINATED status. A job may also be terminated if it has exceeded the maximum run time (term_run_time attribute, if one was specified for the job), or if it was killed from the command line through a UNIX kill command. AutoSys issues an alarm if a job is terminated.
  8. RESTART : The job was unable to start due to hardware or application problems, and has been scheduled to restart.
  9. QUE_WAIT : The job can logically run (that is, all the starting conditions have been met), but there are not enough machine resources available.
  10. ON_HOLD : This job is on hold and will not be run until it receives the JOB_OFF_HOLD event.
  11. ON_ICE : This job is removed from all conditions and logic, but is still defined to AutoSys. Operationally, this condition is like deactivating the job. It will remain on ice until it receives the JOB_OFF_ICE event.

Qs: What is the difference between
"on hold" and "on ice" ?

The difference between "on hold" and "on ice" is that when an "on hold" job is taken off hold, if its starting conditions are already satisfied, it will be scheduled to run, and it will run. 

On the other hand, if an "on ice" job is taken "off ice," it will not start, even if its starting conditions are already satisfied. This job will not run until its starting conditions reoccur.
 

The other major distinction is that jobs downstream from the job that is "on ice" will run as though the job succeeded. Whereas, all dependent jobs do not run when a job is on "on hold"—nothing downstream from this job will run.


Starting Parameters :


AutoSys determines whether to start or not to start a job based on the evaluation of the starting conditions (or starting parameters) defined for the job. 


These conditions can be one or more of the following:
  • Date and time scheduling parameters are met (it is or has passed the specified date and time).
  • Starting Conditions specified in the job definition evaluate to true.
  • For jobs in a box, the box must be in the RUNNING state.
  • The current status of the job is not ON_HOLD or ON_ICE.
Every time an event changes any of the above conditions, AutoSys finds all the jobs that may be affected by this change, and determines whether or not to start them. 

 
sample jil code / Writing jil code:

jil : Job information language
 

When using JIL to create a job definition, you enter the jil command to display the JIL prompt.

Runs the Job Information Language (JIL) processor to add, update, and delete AutoSys jobs, machines, monitors, and reports. Also used to insert one-time job override definitions.


-------------------------------------------------------------------------------------------------
/* ----------------- SAP_UAT_MU03_C ----------------- */
insert_job: SAP_UAT_MU03_C job_type: c

command: /local/SAP/processCheckUAT.sh
machine: MU03-UAT
owner: admin@MU03-UAT
permission: gx,wx,mx,me
days_of_week: all
start_times: "15:00, 14:00"
description: "Job used for Run testing of process"
alarm_if_fail: 1
max_exit_success: 1
-----------------------------------------------------------------------------------------
--------
 


The above example is a simple jil code of autosys which we have to write if we want any particular job to be through autosys. 

To Insert a new JIL code :
 

issue command "jil"
 

bash-3.00$ jiljil>>1>
 

"The following prompt will appear" copy paste the jil code u have made example of jil code below...........
 

At the end the "C" or "B" determines if the job is box job or child job.
 

if the jil is inserted properly successfull message will come if any errors are there the jil code contains some errors..
if successfull exit;
 

2. Other way is to create a temp file named temp.jil which contains jil code on autosys server: give command.

bash-3.00$ jil<>


Functional Listing of AutoSys Commands :


This section lists which AutoSys commands to use for specific tasks. All commands are for both Windows and UNIX, unless otherwise specified.
  • Accessing Sybase : xql
  • Checking System Status :
    • autoflags 
    • autoping
    • autosyslog
    • chase chk_auto_up
  • Converting cron to JIL (UNIX Only) : cron2jil
  • Defining AutoSys Jobs or Machines : jil
  • Defining Calendars : autocal, autocal_asc
  • Reporting Job Status :
    • autorep
    • autostatus
  • Starting AutoSys (UNIX Only) : eventor
  • Stopping AutoSys : sendevent


Using Autorep command:

Function:
 

Reports information about a job, jobs within boxes, machines, and machine status. Also reports information about job overrides and global variables.
 

Syntax:

autorep {-J job_name -M machine_name -G global_name} [-s -d -q -o over_num] [-r run_num]

autorep -J (job name)

This will display a list of jobs with complete details with box/jobname, last/latest run date & time, status, exit code, etc.
 

Viewing JIL code for any Autosys job

autorep -J (job name) -q

To obtain the underlying JIL (Job Interaction Language) source code for any Autosys job, run command.

To obtain the information of previous runs

autorep -J (job name here) -r (No of runs back) 

example : autorep -J (job name here) -r 1

would generate a report for the job run one runs back





/*-------------------------------------------------------------------------------------------------
Status Abbreviations
 

The following table lists the abbreviations used in the ST (status) column of the autorep report, and gives the status for each abbreviation.

AC - ACTIVATED
FA - FAILURE
IN - INACTIVE
OH - ON_HOLD
OI - ON_ICE
QU - QUE_WAIT
RE - RESTART
RU - RUNNING
ST - STARTING
SU - SUCCESS
TE - TERMINATED

-------------------------------------------------------------------------------------------------*/





sendevent commnd:

sendevents to AutoSys for a variety of purposes: 
  • including starting or stopping AutoSys jobs, 
  • stopping the Event processor, 
  • 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. 
  • This option is required for all events except STOP_DEMON, COMMENT, ALARM, or SET_GLOBAL
-E event : 

Specifies the event to be sent. This option is required if any one of the following events may be specified:
  • STARTJOB
  • KILLJOB
  • DELETEJOB
  • FORCE_STARTJOB
  • JOB_ON_ICE
  • JOB_OFF_ICE
  • JOB_ON_HOLD
  • JOB_OFF_HOLD
  • CHANGE_STATUS
  • STOP_DEMON
  • CHANGE_PRIORITY
  • COMMENT
  • ALARM
  • SET_GLOBAL
  • SEND_SIGNAL

Following are the example of sendevent command frequently used.

____________________________________________________________________

To start or force start a job manually using sendevent :

sendevent –E FORCE_STARTJOB -J "Job Name"

sendevent -E STARTJOB -J "Job Name"

To put jobs on OFF ICE or ON ICE :

sendevent -E OFF_ICE -J "Job Name"

sendevent -E ON_ICE -J "Job Name"
______________________________________________________________


autostatus command: 

Reports the current status of a specific job, or the value of an AutoSys global variable. 

Ex: autostatus -J job_name, -S instance

AutoSys Cheatsheet


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:


1.      gatekeeper:  

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


2.      eventor [-M machine_name] :

Starts the event processor.


3.      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 -q > file_name 

queries the DB & save job Dfn into a file 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)


4.  Sendevent Command:   

 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)]


5.      chk_auto_up

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


6.      autoping -m machine: 

verify that both client & server are correctly configured.


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


8.      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


9.      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.


11.  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)


12.  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

13.  autocal_asc full_cal_name

prints, adds & deletes custom calendar definitions.

14.  autostatus

Reports the current status of a specific job, or the value of an AutoSys global variable. 

Ex: autostatus -J job_name, -S instance


15.  autotimezone -l

Allows additions, deletions, and queries to the timezones table 

(-l provides list).

16.  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.


17.  autosys_secure

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

18.  chase [-A|E]: 

Makes sure that jobs claiming to be running in the client machine are running. The "-E" option restarts the job.

19.  archive_events

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

20.  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.

21.  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: 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.