schedule

Schedules and manages jobs to be run one or more times

APPLICABILITY

ClearCase (cleartool subcommand)

SYNOPSIS

DESCRIPTION

The schedule command creates and manages ClearCase-related jobs 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 ClearCase host that runs the albd_server.

Task and Job Storage

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, ccase-home-dir\var\scheduler\tasks\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 ClearCase tasks, but you can add your own task definitions at the end of the file. For more information, see Task Definition Syntax.

Standard ClearCase tasks reside in the directory ccase-home-dir\config\scheduler\tasks. These tasks are not editable.

Tasks that you define can reside anywhere in the file system, but the recommended location is the directory ccase-home-dir\var\scheduler\tasks. This directory contains a task, ccase_local_day.bat, that is intended for user-defined operations to be run daily. The directory contains another task, ccase_local_wk.bat, 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 ccase-home-dir\var\scheduler\db. This is a binary file that you can read and edit only by using the schedule command or the scheduling user interface. When you use the schedule command to change the job database, you use the job definition language described in Job Definition Syntax.

Task and Job Database Initialization

ClearCase installs a template for an initial task database, containing definitions for standard tasks, as the file ccase-home-dir\config\scheduler\tasks\templates\task_registry. The albd_server uses this template to create the first version of the actual task database, ccase-home-dir\var\scheduler\tasks\task_registry.

ClearCase installs templates for two customized tasks, ccase_local_day.bat and ccase_local_wk.bat, in the directory ccase-home-dir\config\scheduler\tasks\templates. The albd_server uses these templates to create initial versions of these tasks in the directory ccase-home-dir\var\scheduler\tasks.

ClearCase installs an initial set of job definitions as the text file ccase-home-dir\config\scheduler\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, ccase-home-dir\var\scheduler\db.

NOTE: Do not edit or delete any files in the directory tree whose root is ccase-home-dir\config\scheduler.

Default Schedule

When no job database exists, the albd_server uses the initial set of job definitions in the file ccase-home-dir\config\scheduler\initial_schedule to create a default schedule. This schedule consists of some jobs run daily and other jobs run weekly.

Daily jobs:

Weekly jobs:

The default schedule also includes three jobs to automate the synchronization of MultiSite replicas. These jobs are designed to run daily but are disabled by default, whether or not MultiSite is installed. For more information on these jobs and how to enable them for use with MultiSite, see ClearCase MultiSite Manual.

Job Timing Options

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.

Job Definition Syntax

The -edit and -set options create or modify jobs 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:

Job.property_name: value

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:

Job.property_name.field: value

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 7 lists editable job properties.

Table 7 Editable Job Properties (Part 1 of 2)


Property

Field

Value

Default

Name



name_string (quoted if it contains white space; must be unique across jobs)


No default; a value is required.


Description


Begin


desc_string (on subsequent lines only; maximum 255 characters)


""


End


(none)



Schedule


(see Table 8)


(see Table 8)


No default; a value is required.


Task



task_id (unsigned) | task_name (string)


No default; a value is required.


Args



arg_string [...]
(arg_string quoted if it contains white space)


No args


DeleteWhenCompleted



TRUE | FALSE


FALSE


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


email


Recipients


address [,...]

Table 8 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 is the time interval between subsequent invocations of the job, if any, on each day it is scheduled. LastStartTime is meaningful only with StartTimeRestartFrequency; it determines the last time the job is eligible to run on each day it is scheduled.

All dates and times are local to the host on which the scheduler is running.

Table 8 Fields of the Job Schedule Property 


Schedule Field

Subfield

Value

Default

Monthly


Frequency


every_n_months (unsigned)


No default; if any Monthly subfield is specified, all must be specified.


Day


day_number | ordinal_spec day_spec

(day_number ::= 1 ... 31)

(ordinal_spec ::= First | Second | Third | Fourth | Last)

(day_spec ::= Mon | Tue | Wed | Thu | Fri | Sat |Sun | Weekday | Weekendday | Day)


Weekly


Frequency


every_n_weeks (unsigned)


No default; if any Weekly subfield is specified, all must be specified.


Days


Mon | Tue | Wed | Thu | Fri | Sat | Sun
[,...]


Daily


Frequency


every_n_days (unsigned)


No default


StartDate



[d]d-month-[yy]yy

(month ::= January ... December | Jan ... Dec)


Today


LastDate



StartDate | [d]d-month-[yy]yy

(month ::= January ... December | Jan ... Dec)


No last date


FirstStartTime



[h]h:[m]m:[s]s (24-hour format)


Now


StartTimeRestartFrequency



[h]h:[m]m:[s]s (24-hour format)


No restart


LastStartTime



[h]h:[m]m:[s]s (24-hour format)


Midnight


Sequential


FollowsJob


job_id (unsigned) | job_name (string)


No default

Table 9 lists read-only job properties. For the LastCompletionInfo property, ExitStatus is the value returned by the wait() system call on UNIX or by the GetExitCodeProcess() function on Windows. Only the first 511 bytes of standard output and error messages are displayed.

Table 9 Read-Only Job Properties 


Property

Field

Value

Id



job_id (unsigned)


Predefined



TRUE | FALSE


Created



dd-month-yy.hh:mm:ss by user.group@host


LastModified



dd-month-yy.hh:mm:ss by user.group@host


NextRunTime



dd-month-yy.hh:mm:ss


RunningStatus


ProcessId


process_id (unsigned)


Started


dd-month-yy.hh:mm:ss


LastCompletionInfo


ProcessId


process_id (unsigned)


Started


dd-month-yy.hh:mm:ss


Ended


dd-month-yy.hh:mm:ss


ExitStatus


exit_status (hexadecimal)


Begin


output_and_error_messages (on subsequent lines only)


End


(None)

Following is an example definition you can use with the -edit or -set option to create a job scheduled to run daily:

Job.Begin
    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: 11-Mar-99
    Job.Schedule.FirstStartTime: 04:30:00
    Job.Task: "VOB Pool Scrubber"
Job.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: 8
    Job.Name: "Weekly VOB Database Scrubbing"
    Job.Description.Begin:
Scrub the VOB database of all local VOBs.
    Job.Description.End:
    Job.Schedule.Sequential.FollowsJob: 7
    # Job.Schedule.Sequential.FollowsJob: "Weekly MVFS Log Scrubbing"
    Job.DeleteWhenCompleted: FALSE
    Job.Task: 4
    # Job.Task: "VOB DB Scrubber"
    Job.Args:
    Job.Created: 11-Mar-99.14:12:59 by fran@acme
    Job.LastModified: 11-Mar-99.14:12:59 by fred@acme
    Job.LastCompletionInfo.ProcessId: 394
    Job.LastCompletionInfo.Started: 21-Mar-99.00:30:08
    Job.LastCompletionInfo.Ended: 21-Mar-99.00:31:08
    Job.LastCompletionInfo.ExitStatus: 0x0
Job.End

Task Definition Syntax

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:

Task.property_name: value

In the task database, definitions of standard ClearCase 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 10 lists task properties.

Table 10 Task Properties 


Property

Value

Id


task_id (unsigned; must be unique across tasks; for user-defined tasks, must be 100 or greater)


Name


name_string (quoted if it contains white space; must be unique across tasks)


Pathname


pathname_string (quoted if it contains white space)


UIInfo


info_string (private to ClearCase)

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.

The Pathname value is the pathname of the executable to be invoked when the task is run. The pathname can be relative or absolute. If it is relative, the scheduler looks first for the task in ccase-home-dir\config\scheduler\tasks and then in 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 ClearCase task:

Task.Begin
    Task.Id:       2
    Task.Name:     "View Space"
    Task.Pathname: view_space.bat
    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.bat
Task.End

Job Execution Environment

Each task runs in a separate process started by the albd_server. A task has the following execution environment:

PERMISSIONS AND LOCKS

The scheduler maintains a single access control list (ACL). The ACL determines who is allowed access to the scheduler and to the ACL itself.

The -edit -acl and -set -acl options modify the ACL using a declarative ACL definition language. The -get -acl option displays a textual representation of the current ACL using the same language.

The ACL definition consists of a sequence of ACL entries. Each ACL entry must occupy a single line. Leading white space, lines beginning with number sign (#), and blank lines are ignored. Each ACL entry has the following form:

identity_type:identity access_type

Table 11 lists the identity types and identities allowed in ACL entries. The identity types are case insensitive.

Table 11 Identity Types and Identities in Scheduler ACL Entries 


Identity Type

Identity

Everyone


(None)


Domain


domain_name


Group


domain_name/group_name | domain_name\group_name


User


domain_name/user_name | domain_name\user_name

In the identity portion of an ACL entry, the domain_name is an NIS domain for UNIX clients of the scheduler and a Windows NT Server domain for Windows clients of the scheduler. Note that you must supply a domain in the identity portion of a Group or User ACL entry. For an ACL entry with a Windows NT Server domain, group_name must be a global group, and user_name must be a domain user account. Names of domains, groups, and users are case insensitive for the scheduler.

Note that no white space can appear anywhere in an identity_type:identity specification.

Table 12 lists the access types allowed in ACL entries. The access types are case insensitive.

Table 12 Access Types in Scheduler ACL Entries 


Access Type

Access to Schedule

Access to ACL

Read


Read only


Read only


Change


Read and write; can start jobs


Read only


Full


Read and write; can start jobs


Read and write

Each combination of domain and group or of domain and user represents a single identity. (Note that NIS domains differ from Windows NT Server domains, so a group or user in an NIS domain represents a different identity from the same group or user in a Windows NT Server domain.) Each single identity can have only one access type. However, access rights are inherited from Everyone to Domain to Group to User in such a way that each user has the least restrictive of all these access rights that apply to that user. For example, if a user's ACL entry specifies Read access but the ACL entry for the user's group specifies Change access, the user has Change access. The order of ACL entries is not significant.

A member of the ClearCase group always has Full access to the scheduler on the local host (the computer where that user is logged on). Access rights of a member of the ClearCase group to a scheduler on a remote host are determined by the scheduler's ACL. The default ACL is as follows:

Everyone: Read

This means that by default, everyone can read the schedule, but only a member of the ClearCase group logged on to the computer where the scheduler is running can modify the schedule or the ACL.

Following is an example ACL definition:

# NIS domain acme.com
Domain:acme.com Read
# Windows NT Server domain acme
Domain:acme Read
Group:acme\users Change
User:acme.com\fran Full
User:acme\fran Full

OPTIONS AND ARGUMENTS

Specifying the Host
-hos·t hostname

Specifies the host whose schedule the command operates on. The default is the local host.
Disabling Prompts for Confirmation
-f·orce

Suppresses all prompts to confirm changes. By default, the command asks for confirmation before changing a schedule or ACL.
Displaying Information about Jobs, Tasks, or ACL
-get [ -sch·edule ]

Displays currently scheduled jobs using the scheduler's job definition language. For more information, see Job Definition Syntax. This is the default action for the -get option.
-get -job job-id-or-name

Displays the currently scheduled job identified by job-id-or-name, which is either a number representing the job-ID or a string representing the job name. The job display uses the scheduler's job definition language. For more information, see Job Definition Syntax.
-get -tas·ks

Displays the tasks defined in the task database using the scheduler's task definition language. For more information, see Task Definition Syntax.
-get -acl

Displays the scheduler's access control list (ACL) using the scheduler's ACL definition language. For more information, see PERMISSIONS AND LOCKS.
Editing a Schedule or ACL
-edi·t [ -sch·edule ]

Opens a text editor containing definitions of currently scheduled jobs using the scheduler's job definition language. You can use the editor to add, delete, or modify job definitions. When you are finished, save the modified schedule and exit the text editor. The scheduler then replaces the current schedule with the edited version. For more information, see Job Definition Syntax. This is the default action for the -edit option.
-edi·t -acl

Opens a text editor containing current ACL entries using the scheduler's ACL definition language. You can use the editor to add, delete, or modify ACL entries. When you are finished, save the modified ACL and exit the text editor. The scheduler then replaces the current ACL with the edited version. For more information, see PERMISSIONS AND LOCKS.
Setting a Schedule or ACL Using Definitions in a File
-set [ -sch·edule ] defn-file-pname

Replaces all currently scheduled jobs with the jobs defined in the file whose pathname is defn-file-pname. The definitions in the file use the scheduler's job definition language. For more information, see Job Definition Syntax. This is the default action for the -set option.
-set -acl defn-file-pname

Replaces the current ACL with the ACL defined in the file whose pathname is defn-file-pname. The definitions in the file use the scheduler's ACL definition language. For more information, see PERMISSIONS AND LOCKS.
Operating on a Scheduled Job
-del·ete job-id-or-name

Deletes the scheduled job identified by job-id-or-name, which is either a number representing the job-ID or a string representing the job name.
-run job-id-or-name

Immediately executes the scheduled job identified by job-id-or-name, which is either a number representing the job-ID or a string representing the job name. The job is run in the scheduler's job execution environment. For more information, see Job Execution Environment.
-wai·t job-id-or-name

Waits for completion and displays status of the scheduled job identified by job-id-or-name, which is either a number representing the job-ID or a string representing the job name. This option has no effect if the job is not running.
-sta·tus job-id-or-name

Displays the status of the scheduled job identified by job-id-or-name, which is either a number representing the job-ID or a string representing the job name. Displays the most recent process-ID, start time, end time, and exit status for the job.

EXAMPLES

Examples including 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 command interpreter prompt. In cleartool interactive mode, cmd-context represents the interactive cleartool prompt. In Attache, cmd-context represents the workspace prompt.

cmd-context schedule -get -job "Weekly VOB Database Scrubbing"
Job.Begin
    Job.Id: 8
    Job.Name: "Weekly VOB Database Scrubbing"
    Job.Description.Begin:
Scrub the VOB database of all local VOBs.
    Job.Description.End:
    Job.Schedule.Sequential.FollowsJob: 7
    # Job.Schedule.Sequential.FollowsJob: "Weekly MVFS Log Scrubbing"
    Job.DeleteWhenCompleted: FALSE
    Job.Task: 4
    # Job.Task: "VOB DB Scrubber"
    Job.Args:
    Job.Created: 11-Mar-99.14:12:59 by fran@acme
    Job.LastModified: 11-Mar-99.14:12:59 by fred@acme
    Job.LastCompletionInfo.ProcessId: 394
    Job.LastCompletionInfo.Started: 21-Mar-99.00:30:08
    Job.LastCompletionInfo.Ended: 21-Mar-99.00:31:08
    Job.LastCompletionInfo.ExitStatus: 0x0
Job.End
cmd-context schedule -edit -acl
Replace the ACL? [yes]
cmd-context schedule -host acme1 -set jobdefs.txt
Replace the entire schedule? [yes]
cmd-context schedule -status 1
Job is not currently running.

    RunningJob.CompletionInfo.ProcessId: 380
    RunningJob.CompletionInfo.Started: 25-Mar-99.04:30:01
    RunningJob.CompletionInfo.Ended: 25-Mar-99.04:31:00
    RunningJob.CompletionInfo.ExitStatus: 0x0

FILES

ccase-home-dir\config\scheduler\initial_schedule
ccase-home-dir\config\scheduler\tasks\templates\task_registry
ccase-home-dir\config\scheduler\tasks\templates\ccase_local_day.bat
ccase-home-dir\config\scheduler\tasks\templates\ccase_local_wk.bat
ccase-home-dir\var\scheduler\db
ccase-home-dir\var\scheduler\tasks\task_registry
ccase-home-dir\var\scheduler\tasks\ccase_local_day.bat
ccase-home-dir\var\scheduler\tasks\ccase_local_wk.bat

SEE ALSO

albd_server, dospace, errorlogs_ccase, rgy_backup, scrubber, space, vob_scrubber, vob_snapshot



Feedback on the documentation in this site? We welcome any comments!
Copyright © 1999 by Rational Software Corporation. All rights reserved.