The schedule command creates and manages jobs related to ClearCase and arranges to execute them at specified times. A job consists of an executable program, or task, that the scheduler runs one or more times with a given set of arguments.
The scheduler is available on any host that runs the albd_server.
The scheduler relies on two data repositories:
A task must be defined in the task database before you can schedule it. The task database is a single text file, task_registry. You can add task definitions to the task database by editing this file using a text editor. You must not change the definitions of standard tasks, but you can add your own task definitions at the end of the file. For more information, see Task definition syntax.
Standard tasks reside in the directory tasks. These tasks are not editable. Tasks that you define can reside anywhere in the file system, but the recommended location is the directory tasks. This directory contains a task, ccase_local_day, that is intended for user-defined operations to be run daily. The directory contains another task, ccase_local_wk, that is intended for user-defined tasks to be run weekly. You can customize these two tasks using a text editor or can create entirely new tasks.
The database of jobs is the file db. This is a binary file that you read and edit by using the schedule command. When you use the schedule command to change the job database, you use the job definition language described in Job definition syntax.
ClearCase installs a template for an initial task database, which contains definitions for standard tasks, as the file task_registry. The albd_server uses this template to create the first version of the actual task database, task_registry.
Templates are installed for two customized tasks, ccase_local_day and ccase_local_wk, in the directory templates. The albd_server uses these templates to create initial versions of these tasks in the directory tasks.
ClearCase installs an initial set of job definitions as the text file initial_schedule. These job definitions rely on task definitions in the task registry template. The albd_server uses these job definitions to create the first version of the job database, db.
When no job database exists, the albd_server uses the initial set of job definitions in the file initial_schedule to create a default schedule. This schedule consists of some jobs that are run daily and other jobs that are run weekly. However, these jobs are not run by default: you must explicitly enable them.
You can arrange for a job to run under a variety of schedules:
For daily, weekly, and monthly schedules, you can specify starting and ending dates for the job. To run a job one time, you can specify a daily schedule with identical start and end dates.
The –edit and –set options create or modify jobs by using a declarative job definition language. The –get option displays a textual representation of currently defined jobs using the same language.
The job definition language has the following general features:
A job definition file consists of a sequence of job definitions. Each job definition begins with the statement Job.Begin and ends with the statement Job.End. Between these statements are other statements that define job properties. A statement that defines a job property has the following form:
Some properties have fields. In this case the definition of a property consists of a sequence of statements, one for each field, with the following form:
Some fields themselves have subfields.
The value portion of some property definitions can contain a sequence of individual values separated by commas. No white space can appear before or after a comma that separates two values in a sequence. For the Args property, individual values are separated by white space.
Job properties are of two types:
Table 1 lists editable job properties.
| Name | name_string (quoted if it contains white space; must be unique across jobs) |
||
| Description | Begin | desc_string (on subsequent lines only; maximum 255 characters) |
|
| End | |||
| Schedule | See Table 2 |
SeeTable 2 |
|
| Task | |||
| Args | arg_string [...] (arg_string quoted if it contains white space) |
||
| DeleteWhenCompleted | |||
| NotifyInfo | OnEvents | JobBegin | JobEndOK | JobEndOKWithMsgs | JobEndFail | JobDeleted | JobModified [,...] |
If no NotifyInfo field is specified, no notifications are issued; if any NotifyInfo field is specified, all must be specified. |
| Using | |||
| Recipients |
Table 2 lists fields of the Schedule property. Schedules are of two types:
The Monthly, Weekly, Daily, and Sequential fields are mutually exclusive; each job must have one and only one of these fields.
The StartDate, LastDate, FirstStartTime, StartTimeRestartFrequency, and LastStartTime fields are optional. One or more of these fields can appear along with a Monthly, Weekly, or Daily field. StartDate and LastDate determine the first and last dates the job is eligible to run on its monthly, weekly, or daily schedule. FirstStartTime determines what time the job first runs on each day it is scheduled. StartTimeRestartFrequency specifies an interval to wait before running the job again. LastStartTime is meaningful only with StartTimeRestartFrequency; it determines the last time the job is eligible to run on each day it is scheduled. If StartTimeRestartFrequency is specified for a job, the job will run every StartTimeRestartFrequency (for example, every two hours) until midnight or LastStartTime, whichever is earlier.
All dates and times are local to the host on which the scheduler is running. Date outputs are displayed in ISO format regardless of any user-specified preference for the display format of dates.
Table 3 lists read-only job properties. For the LastCompletionInfo property, ExitStatus is the value returned by the wait() system call on UNIX or Linux or by the GetExitCodeProcess() function on Windows. Only the first 511 bytes of standard output and error messages are displayed.
| Id | ||
| Predefined | ||
| Created | ||
| LastModified | ||
| NextRunTime | ||
| RunningStatus | ProcessId | |
| Started | ||
| LastCompletionInfo | ProcessId | |
| Started | ||
| Ended | ||
| ExitStatus | ||
| Begin | ||
| End |
Following is an example definition the scheduler could display with the –get option for a job scheduled to run sequentially, including job properties defined by the scheduler:
Job.Begin
Job.Id: 1
Job.Name: "Daily VOB Pool Scrubbing"
Job.Description.Begin:
Scrub the cleartext and derived object storage pools of all local VOBs.
Job.Description.End:
Job.Schedule.Daily.Frequency: 1
Job.Schedule.StartDate: 2002-12-30
Job.Schedule.FirstStartTime: 04:30:00
Job.DeleteWhenCompleted: FALSE
Job.Task: 3
# Job.Task: "VOB Pool Scrubber"
Job.Args:
Job.NotifyInfo.OnEvents: JobEndOKWithMsgs,JobEndFail
Job.NotifyInfo.Using: email
Job.NotifyInfo.Recipients: root
Job.Created: 2002-12-30T15:18:06-05 by rational.com/root@phenol
Job.LastModified: 2002-12-30T15:18:06-05 by rational.com/root@phenol
Job.Predefined: TRUE
Job.NextRunTime: 2003-01-10T04:30:00-05
Job.LastCompletionInfo.ProcessId: 21511
Job.LastCompletionInfo.Started: 2003-01-09T04:30:00-05
Job.LastCompletionInfo.Ended: 2003-01-09T04:39:27-05
Job.LastCompletionInfo.ExitStatus: 0x100
Job.LastCompletionInfo.Messages.Begin:
2003-01-09T04:39:26
ClearCase scrubber failed on phenol with exit status 1
Some VOBs were NOT scrubbed
See phenol:/var/adm/rational/clearcase/log/scrubber_log
Job.LastCompletionInfo.Messages.End:
Job.End
A task must be defined in the task database before you can schedule the task. The task database is a text file, which you can edit using a text editor. The task database contains definitions that use a declarative task definition language similar to the job definition language.
The task definition language has the following general features:
The task database file consists of a sequence of task definitions. Each task definition begins with the statement Task.Begin and ends with the statement Task.End. Between these statements are other statements that define task properties. A statement that defines a task property has the following form:
In the task database, definitions of standard tasks appear first. You must not change or delete any of these definitions. You can add task definitions of your own at the end of the task database file.
Table 4 lists task properties.
The scheduler uses the task Id property in a job definition to identify the task to run. If any scheduled jobs use a task Id, you must be careful not to change the task's Id property in the task database without also changing all references to that property in the database of scheduled jobs.
Platform |
First location |
Second location |
|---|---|---|
UNIX and Linux |
ccase-home-dir/config/scheduler/tasks |
/var/adm/rational/clearcase/scheduler/tasks |
Windows |
ccase-home-dir\config\scheduler\tasks |
ccase-home-dir\var\scheduler\tasks |
The optional UIInfo property describes the task's command-line interface, such as the types of arguments the task can take. This property is used internally by ClearCase; do not specify it for a user-defined task.
Following is an example read-only definition for a standard task:
Task.Begin Task.Id: 2 Task.Name: "View Space" Task.Pathname: view_space.sh Task.UIInfo: "view-spec" Task.End
Following is an example definition for a user-defined task:
Task.Begin Task.Id: 100 Task.Name: "Daily Local Tasks" Task.Pathname: ccase_local_day.sh Task.End
Each task runs in a separate process started by the albd_server. A task has the following execution environment:
The UNIX system and Linux examples in this section are written for use in csh. If you use another shell, you may need to use different quoting and escaping conventions.
The Windows examples that include wildcards or quoting are written for use in cleartool interactive mode. If you use cleartool single-command mode, you may need to change the wildcards and quoting to make your command interpreter process the command appropriately.
In cleartool single-command mode, cmd-context represents the UNIX system and Linux shells or Windows command interpreter prompt, followed by the cleartool command. In cleartool interactive mode, cmd-context represents the interactive cleartool prompt.
cmd-context schedule –get –job "Daily VOB Pool Scrubbing"
Job.Begin
Job.Id: 1
Job.Name: "Daily VOB Pool Scrubbing"
Job.Description.Begin:
Scrub the cleartext and derived object storage pools of all local VOBs.
Job.Description.End:
Job.Schedule.Daily.Frequency: 1
Job.Schedule.StartDate: 2002-12-30
Job.Schedule.FirstStartTime: 04:30:00
Job.DeleteWhenCompleted: FALSE
Job.Task: 3
# Job.Task: "VOB Pool Scrubber"
Job.Args:
Job.NotifyInfo.OnEvents: JobEndOKWithMsgs,JobEndFail
Job.NotifyInfo.Using: email
Job.NotifyInfo.Recipients: root
Job.Created: 2002-12-30T15:18:06-05 by rational.com/root@phenol
Job.LastModified: 2002-12-30T15:18:06-05 by rational.com/root@phenol
Job.Predefined: TRUE
Job.NextRunTime: 2003-01-10T04:30:00-05
Job.LastCompletionInfo.ProcessId: 21511
Job.LastCompletionInfo.Started: 2003-01-09T04:30:00-05
Job.LastCompletionInfo.Ended: 2003-01-09T04:39:27-05
Job.LastCompletionInfo.ExitStatus: 0x100
Job.LastCompletionInfo.Messages.Begin:
2003-01-09T04:39:26
ClearCase scrubber failed on phenol with exit status 1
Some VOBs were NOT scrubbed
See phenol:/var/adm/rational/clearcase/log/scrubber_log
Job.LastCompletionInfo.Messages.End:
Job.End
cmd-context schedule –host acme1 –set jobdefs.txt
Replace the entire schedule? [yes]
cmd-context schedule –status 2
Job is not currently running.
RunningJob.CompletionInfo.ProcessId: 21518
RunningJob.CompletionInfo.Started: 2003-01-09T04:39:27-05
RunningJob.CompletionInfo.Ended: 2003-01-09T04:40:03-05
RunningJob.CompletionInfo.ExitStatus: 0x0