Overview
Job dependencies mean that jobs depend on the status (such as
Completed Normally
) of other jobs to run. Using file dependencies, you can have jobs depend on the availability and status of files as a condition of execution. File dependencies are set up using the
File Dependency
dialog which is accessible when you create or edit a job definition.
In this chapter, we will create a job (
Unix_Download
) that is dependent on the existence of the
UNIX_log.txt
file.
Figure 6-1 Unix_Download Job Depends on the Existence of the Unix_log File
To properly complete this exercise, you need to have a solid understanding of the following concepts:
-
How to add and create a new job definition
-
How to navigate to and between the
Jobs
pane and the
Job Activity
pane
This chapter describes how to:
-
Create a job with a file dependency
-
Create a file to satisfy the dependency
Note To complete the exercises in this tutorial, you need to:
Install Enteprise Scheduler in the default directory Scheduler (or the examples in this tutorial will not work properly)
Select the Super User option in your User definition
Configure a default agent
Create and have available the work day calendar
Creating a Job with a File Dependency
To create a job with a File dependency:
Step 1 From the
Navigator
pane, select
Definitions>Jobs
to display the
Jobs
pane.
Step 2 Right-click in the
Jobs
pane of the console and select
Add Job
from the context menu, or click the
Add Job
button on the Scheduler toolbar.
The
Job Definition
dialog displays.
Step 3 In the
Job Name
field, type
Unix_Download
.
Step 4 In the
Command
field, enter the full path to the file:
/Unix_Test_5.sh
Step 5 Click the
Schedule
tab and from the
Calendar Name
list select the
work day
calendar.
Step 6 Click the
Run
tab and from the
Runtime User
list, select a user who can access the Unix agent.
Step 7 Click the
Dependencies
tab.
Step 8 Display the
File Dependency
dialog by clicking the
Add
button and selecting
Add File Dependency
field.
a. Enter
/Unix_log.txt
in the
File Name
field
.
The full path to this file must be typed in because the file does not yet exist. We will create
Unix_log.txt
later, in the section Creating a File to Satisfy the Dependency.
b. The
Agent Name
field should already have a Unix agent listed–the agent you selected as your default agent at the beginning of this tutorial. If there is no agent listed or an agent other than the Unix agent is selected, then select your local Unix agent from the
Agent Name
list.
Note The Unix_log.txt file must reside in the / (root level) of the machine where the Unix agent is installed so this tutorial works properly.Click OK to accept the default settings. Enteprise Scheduler’s default is that the dependency is met after the file is created.
Step 9 Click the
Dependencies
tab.
The full path to
Unix_log.txt
displays in the
Dependency Name
column. The
Type
of dependency is listed as
FILE
to indicate that it is a file dependency.
Step 10 Click
OK
to save the job definition for
Unix_Download
.
Step 11 Click
OK
in the
Effective Date
dialog to add the job to the schedule.
Viewing the Job in Production
To view the job in production:
Step 1 Open the
Job Activity
pane.
Step 2 The
Unix_Download
job first appears with a
Waiting on Dependencies
status. It goes through different stages and ends in a
Scheduled
status.
Figure 6-2 Unix_Download Job Scheduled to Run
Step 3 Select the
Unix_Download
job occurrence.
Step 4 Right-click the
Unix_Download
occurrence and select
Details
from the context menu to see its
Job Detail
dialog.
Step 5 Click the
Dependencies
tab to view the file dependency status.
The
Job Detail
dialog displays the file dependency for this job.
Step 6 Click
OK
to close the dialog.
Creating a File to Satisfy the Dependency
In this example, the dependency only requires that the file exists and does not require any specific data. For this exercise, we just create an empty file since the job does not require any data from the file. Normally, however, this kind of dependency is set up because the job uses the data from the file’s input.
To create a file to satisfy the dependency:
Step 1 Open a new document in a text editor or word processing program, such as vi, joe or pico.
Step 2 Go to the directory where you copied the tutorial files. For your file to satisfy the dependency, the name must match
exactly
. File names are case-sensitive in Unix so even if a file has the same spelling, if some of the letters in the name are not the same case, the name is not recognized.
Step 3 Rename the
Unix_log.txt
file to
Unix_Log.txt
:
mv Unix_log.txt Unix_Log.txt
Monitoring the Job in Production
Open the
Job Activity
pane.
You can see that the file dependency for the
Unix_Download
job is met and the job goes from a
Waiting on Dependencies
state into an
Active
state.
Congratulations! In this chapter, you have created a job with a file dependency, and fulfilled that dependency requirement by creating the file. By this time, you should also feel comfortable with moving between the
Job Activity
pane and
Jobs
pane, and with the basic procedure for adding a job.