job

Required Command-Line Mode = Configure

Required User Level = Admin

Use the job command to configure scheduled jobs.

The job command has the following syntax:

job <job ID>
   command <sequence #> <CLI command>
   comment <string>
   enable
   execute
   fail-continue
   name <friendly name>
   schedule type <daily | monthly | once | periodic | type | weekly>

The following table describes the arguments for the job command:

Argument

Description

<job ID>

Specifies an ID number of a job.

command <sequence #>    <CLI command>

Adds a CLI command to a job. The sequence # is an integer that controls the order in which commands are executed relative to other commands in the job. For example:

(config) # job 12 command 1 “map alias recordtodiskmap from 1/1/x1..x10”

Note:  Commands are not validated when a job is configured. To avoid a problem during execution, a good practice is to do a dry run first.

comment <string>

Adds a comment to a job. For example:

(config) # job 12 comment “weekly job”

show jobs command.

enable

Enables or disables a job. For example:

(config) # job 12 enable

If a job is disabled, it will not be executed automatically according to its schedule. Also, if a job is disabled, it cannot be executed manually.

execute

Forces the immediate execution of a job. For example:

(config) # job 12 execute

The use of this command does not affect the execution of a scheduled job.

Note:  To execute immediately, the job must be enabled.

fail-continue

Continues execution of a job, regardless of any failures. For example:

(config) # job 12 fail-continue

By default, a job halts as soon as any command in the job fails.

name <friendly name>

Configures a friendly name for a job. For example:

(config) # job 12 name MyJob

schedule type <daily | monthly |    once | periodic | weekly>

Configures the type of schedule on which a job automatically executes. The schedule types are as follows:

daily—Executes the job daily at a specified time. For details on daily schedules, refer to schedule daily.
monthly—Executes the job monthly on a specified day of the month. For details on monthly schedules, refer to schedule monthly.
once—Executes the job once at a single specified date and time. For details on one-time schedules, refer to schedule once.
periodic—Executes the job periodically on a specified fixed time interval, beginning at a fixed point in time. For details on periodic schedules, refer to schedule periodic.
weekly—Executes the job weekly at a specified time on one or more specified weekdays. For details on weekly schedules, refer to schedule weekly.
The default is once.

Each schedule type requires additional parameters. Refer to schedule.

   schedule daily       time <hh>:<mm>:<ss> |   schedule daily start date       <yyyy>/<mm>/<dd>   schedule daily end date       <yyyy>/<mm>/<dd>

Sets the time at which a daily job will execute every day, or sets a date range within which the daily job is eligible to execute.

For example:

(config) # job 12 schedule daily time 10:02:22

(config) # job 12 schedule daily start date 2014/12/25

(config) # job 12 schedule daily end date 2014/12/26

For start and end, you can specify an absolute start and end date.

   schedule monthly       day-of-month<day> |   schedule monthly time       <hh>:<mm>:<ss> |    schedule monthly interval       <months> |   schedule monthly start date       <yyyy>/<mm>/<dd>   schedule monthly end date       <yyyy>/<mm>/<dd>

Sets the day of the month at which a job will execute monthly, or sets the time of day at which the job will execute on the day of the month specified, or sets the number of months between executions of the monthly job, or sets a date range within which the monthly job is eligible to execute.

For example:

(config) # job 12 schedule monthly day-of-month 15

(config) # job 12 schedule monthly time 10:03:22

(config) # job 12 schedule monthly interval 3

(config) # job 12 schedule monthly start date 2014/12/2

(config) # job 12 schedule monthly end date 2014/12/2

For day-of-month, you can specify days as a number from 1 to 28. (Days 29-31 are not allowed.) However, you can also specify days as a number from -1 to -28, which is the number of days before the first of the following month. For example, -1 means the last day of the month, -2 means the second to last day of the month.

For interval, you can specify the number of months between executions. For example, 2 means every 2 months.

For start and end, you can specify an absolute start and end date.

   schedule once       time <hh>:<mm>:<ss>       [date <yyyy>/<mm>/<dd>]

Sets the date and time at which a job will execute once.

For example:

(config) # job 12 schedule once time 10:03:22 date 2014/12/25

   schedule periodic       interval <time interval> |   schedule periodic start date       <yyyy>/<mm>/<dd>      [time <hh>:<mm>:<ss>]   schedule periodic end date       <yyyy>/<mm>/<dd>      [time <hh>:<mm>:<ss>]

Sets the time interval between executions of the periodic job, or sets the date and time range within which the periodic job is eligible to execute.

For example:

(config) # job 12 schedule periodic interval 2h3m4s

(config) # job 12 schedule periodic start date 2014/12/25 time 10:03:22

(config) # job 12 schedule periodic end date 2014/12/2 time 10:03:30

For start and end, you can specify an absolute start and end date, and absolute start and end time.

   schedule weekly       time <hh>:<mm>:<ss> |   schedule weekly time day-of-week       <sun | mon | tue | wed | thu | fri |       sat> |   schedule weekly start date       <yyyy>/<mm>/<dd>   schedule weekly end date       <yyyy>/<mm>/<dd>

Sets the time at which a job will execute weekly, or sets the days of the week on which the job will execute, or sets a date range within which the weekly job is eligible to execute.

For example:

(config) # job 12 schedule weekly time 10:03:22

(config) # job 12 schedule weekly day-of-week mon

(config) # job 12 schedule weekly start date 2014/12/25

(config) # job 12 schedule weekly end date 2014/12/2

For time, the single time specified under weekly applies to all selected days.

For day-of-week, you can specify more than one day, but each day cannot be specified more than once.

For start and end, you can specify an absolute start and end date.

Related Commands

The following table summarizes other commands related to the job command:

Task

Command

Displays the configuration and state of all jobs.

Note:  Job state information is lost on reboot.

# show jobs

Displays the configuration and state of a specified job, including the results of the last execution.

# show jobs 12

Deletes a specified job.

(config) # no job 12

Deletes a command from a job.

(config) # no job 12 command 1

Deletes a comment associated with a job.

(config) # no job 12 comment

Disables a job.

(config) # no job 12 enable

Returns execution to the default behavior.

(config) # no job 12 fail-continue

Deletes the name of a job.

(config) # no job 12 name

Resets the schedule type to its default, which is once.

(config) # no job 12 schedule type

Resets the schedule type once to its default time, which is midnight on January 1, 1970 (which means no automatic execution).

(config) # no job 12 schedule once time

Resets the daily schedule to its default time, which is midnight.

(config) # no job 12 schedule daily time

Resets the weekly schedule to its default time, which is midnight.

(config) # no job 12 schedule weekly time

Resets the monthly schedule to its default day, which is 1.

(config) # no job 12 schedule monthly day-of-month

Resets the monthly interval to its default, which is 1.

(config) # no job 12 schedule monthly interval

Resets the periodic interval to its default, which is 1 hour.

(config) # no job 12 schedule periodic interval

Schedules the execution of a script, for example, to apply a configuration text file.

(config) # job 12 command 1 “configuration text file addstoragemap.txt apply fail-continue”

Schedules the execution of a script, for example, to upload a configuration text file.

Note:  For uploading configuration and other files, generating a public key for authentication is recommended.

(config) # job 12 command 1 “configuration text generate active running upload scp://qa:qa@1.1.1.1/daily”

Schedules a job to run at night. For example, you might want to turn off monitoring at night because your network is doing lots of backups or storage maintenance.

The next morning, you can run the following job.

(config) # job 12 command 1 “no map alias recordtodiskmap”

 

(config) # job 13 command 1 “map alias recordtodiskmap from 1/1/x1..x10”