Commands for scheduling tasks

This topic describes the commands used with the CronJob service command-line interface. Use these commands to schedule tasks such as usage data collection.

To use the command-line interface:

  1. Log in, as domain administrator, to the PE server that is set up to run scheduled tasks. The CronJob service must be enabled and configured before scheduled tasks can run.

  2. Open a command window and change (cd) to the CronJob service directory. If defaults were used during installation, the directory is:

    C:\Program Files\Ensim\Ensim Unify
     

  3. When typing commands on the command line, use this format:

CronJobService.exe <command syntax>

Syntax

{-|/}<command>{=|:| }<options>

Syntax legend

Format

Meaning

Between braces ({}); choices separated by pipe (|)

Choices from which the user must choose only one

Between brackets ([])

Optional items

Between angle brackets (<>)

Information the user supplies

Ellipsis (...)

Parameter that can be repeated on a command line

Commands

The following table shows commonly used commands and options. Other commands might also be available, but using them is not recommended.

All command line options are not case-sensitive; upper- and lowercase characters produce the same results.

Command

Description

h[elp]

Shows the command line syntax.

l[ist] [{<jobId>[,<jobId>...]|*}]

 

Lists scheduled tasks. The default for this command, *, returns a list of all scheduled tasks.

u[pdate] <jobId> <jobInfo>

Modifies the schedule of an existing task. For example, you can use this command to change the schedule of a task or to enable a task that has been disabled. Use the list command to view the jobIds and scheduling information of existing tasks. See <jobInfo> for a list of related options.

d[isable] {<jobId>[,<jobId>...]|*}

Disables tasks. Use * to apply the command to all tasks. Use the update command to enable tasks that have been disabled.

* applies the command to all items

<jobInfo> options

<jobInfo> options are used with the update command. The syntax for <jobInfo> options is the same as for commands.

Option

Description

Defaults and valid input

r[ecurrence] <recurrence>

Required. The frequency at which the task runs. If the interval is also set, the interval determines the number of times per recurrence the task is to run.

See recurrence options.

i[nterval] <intervalInUnits>

Optional. The space or interval between task runs, based on the specified recurrence.

For example, assuming the recurrence is set to weekly:

  • If the interval is set to 1, the task runs once every week.

  • If the interval is set to 2, the task runs once every 2 weeks.

Default = 1

Valid input = positive integers

s[tartdate] <scheduleStartDate>

Optional. The day on which the task is to start running.

Default = the current date and time

Valid input = "MM/DD/YY HH:mm"

Example: "12/15/05 13:15" is December 15, 2005 at 1:15 PM

e[nddate] <scheduleEndDate>

Optional. The expiration date of the task. The job does not run after this date.

Default = never

Valid input = "MM/DD/YY HH:mm"

Example:, "12/15/05 13:15" is December 15, 2005 at 1:15 PM

d[ata] <dataString>

Optional. Additional data/XML used by some services.

Default = null

[unify]service <UnifyServiceId>

Optional. Associates the task with a specific service.

Default = null

Recurrence

The recurrence options are used to specify how often tasks run. If the interval option is also used, the task runs according to the interval and recurrence. Recurrence options include:

{ 0[NCE] | Y[EARLY] | M[ONTHLY] | W[EEKLY] | D[AILY] | H[OURLY] | S[ECONDS] | [[[MM]{DD|7D}]HH]mm }
 

Recurrence

Description

O[NCE]

Runs the task once only, as specified by the startdate option.

Example: /r o

Y[EARLY]

Runs the task every year or at the specified interval.

Example: /r y

M[ONTHLY]

Runs the task every month or at the specified interval.

Example: /r m

W[EEKLY]

Runs the task every week or at the specified interval.

Example: /r w

D[AILY]

Runs the task every day or at the specified interval.

Example: /r d

H[OURLY]

Runs the task every hour or at the specified interval.

Example: /r h

S[ECONDS]

Enables you to specify the interval between task runs in seconds.

Example: /r s /i 3600 schedules the task to run once every 3600 seconds (once every hour).

[[[MM]{DD|7D}]HH]mm

An alternative to the options above, this format enables you to specify the recurrence as the date and/or the time for the task to run.

Options include:

  • mm. Minutes. If only minutes are specified, the recurrence is hourly. If hours are also specified, use two digits to specify minutes.

Example: /r 15 schedules the task to run every hour at 15 minutes past the hour.

  • HH. Hours. Specify hours in a 24-hour clock format. For example, to specify 6 AM use 06; to specify 1 PM, use 13.

If only hours and minutes are specified, the recurrence is daily at the specified time.

Example: /r 2015 schedules the task to run at 8:15 PM daily.

  • DD. Days. Specifies the day of the month. If specified as DDHHmm, the recurrence is monthly.

Example: /r 252015 schedules the task to run on the 25th day of every month at 8:15 PM.

  • 7D. Day of the week, used for weekly recurrence. Days are numbered from 1-7, starting with Sunday. For example, Sunday is specified as 71; Monday is specified as 72.

Example: /r 722015 schedules the task to run every Monday at 8:15 PM.

  • MM. Months, used to schedule annual tasks.

Example: /r 12242015 schedules the task to run every December 24th at 8:15 PM.

Examples

The following examples show how to use the command line to schedule the UsageMonitor task. In these examples, the <jobId> for the UsageMonitor task is assumed to be 10. UsageMonitor is the task that collects service usage data.
 

Task schedule

Command

Run monthly on the last day of the month at 10:45 AM (although the day of the month is specified as 31, the task runs on the last day of the month for months with fewer than 31 days)

/recurrence 311045

or

/startdate “1/31/2005 10:45” /recurrence m

Run every hour, starting now (for instance, if it is 10:20 now, the task runs every hour at 20 minutes past the hour)

/update 10 /recurrence h

Run every hour at 15 minutes past the hour (regardless of the current time)

/update 10 /recurrence 15

Run every third day at 13:15 (1:15 PM)

/update 10 /recurrence d /i 3 /s "12/15/05 13:15"

or

/update 10 /recurrence 1315 /i 3

Run weekly on the same day and time as now

/update UsageMonitor /recurrence w

Run every monday at 13:15 (1:15 PM)

/update 10 /recurrence 721315

or

/update 10 /recurrence w /startdate "12/15/05 13:15"