job

In the config context:

job <JOB-NAME>

no job [<JOB-NAME>]

 

Subcommands available In the job config context (config-job):

[no] enable

[no] desc <DESCRIPTION>

[no] [<SEQ-NUM>] [delay <DELAY>] cli <COMMAND>

resequence <START-SEQ-NUM> <INCREMENT>

Description

If <JOB-NAME> does not exist, this command creates a job and then enters its context.

The no form of this command deletes the specified job. If no job is specified, all jobs are deleted.

Deleting a job also removes it from any schedule that uses the job, preventing further attempts to execute the job.

If <JOB-NAME> exists, this command enters the config-job-<NAME> context for the specified job.

Parameter

Description

<JOB-NAME>

Specifies the job name. Range 1 to 64 characters (alphanumeric and "_" (underscore)

Subcommands

These subcommands are available within the config-job-<NAME> context for configuring the job:

enable

Enables the job (the default). no enable disables the job.

[no] desc <DESCRIPTION>

Specifies a user-defined job description. no desc removes the description. Range: 1 to 128 characters. For example:

switch(config-job-PTog1)# desc Toggle port 1/1/1

[no] [<SEQ-NUM>] [delay <DELAY>] cli <COMMAND>

Adds a CLI command to the job. The no form removes the command from the job. When executed, commands with simple (y/n) prompts (such as boot system) will be automatically confirmed with "y." Other commands requiring more complex user input (such as password change) cannot be used.

<SEQ-NUM> specifies the job CLI command sequence number to facilitate ordering of commands within a job. When omitted, a sequence number that is 10 greater the highest existing sequence number is auto-assigned. The first auto-assigned sequence number is 10. Range: 1 to 4294967295.

[delay <DELAY>] specifies the delay in seconds before this CLI command is executed. The cumulative delay for all commands in a job must be no more than 300 seconds. Range 1 to 300.

cli <COMMAND> specifies the CLI command to be executed. Range 1 to 4096 characters.

These commands must not be used in a job: copy, repeat, show boot-history, show core-dump, show events, show job, show tech, sleep, terminal-monitor.

For example, adding a command as line 18 to a job:

switch(config-job-PTog1)# 18 cli interface 1/1/1

resequence <START-SEQ-NUM> <INCREMENT>

Resequences the CLI command line sequence numbers. Both <START-SEQ-NUM> and <INCREMENT> default to 10. For example, resequencing the CLI command list to start at 10 with an increment of 5.

switch(config-job-PTog1)# resequence 10 5 switch(config-job-PTog1)# show job PTog1 Job Name : PTog1 ... Job CLI commands ---------------- 10 cli config 15 cli interface 1/1/1 20 cli shutdown ...

Usage

  • A maximum of 20 commands can be used in a job.
  • To see the maximum number of jobs and job execution output preserved instances for your particular switch, use command show capacities job.
  • Jobs must complete execution in under five minutes and are force-stopped after five minutes if they do not.

Examples

Creating a port toggle job named PTog1:

switch(config)# job PTog1 switch(config-job-PTog1)# desc Toggle port 1/1/1 switch(config-job-PTog1)# 10 cli config switch(config-job-PTog1)# 20 cli interface 1/1/1 switch(config-job-PTog1)# 30 cli shutdown switch(config-job-PTog1)# 40 delay 10 cli no shutdown switch(config-job-PTog1)# 50 cli end switch(config-job-PTog1)# exit switch(config)#

Creating a job named Reboot_sw1 that saves the running configuration and then reboots the switch:

switch(config)# job Reboot_Sw1 switch(config-job-Reboot_sw1)# desc Save config then reboot switch switch(config-job-Reboot_Sw1)# 10 cli config switch(config-job-Reboot_Sw1)# 20 cli write mem switch(config-job-Reboot_Sw1)# 30 cli boot system switch(config-job-Reboot_Sw1)# exit switch(config)#

For more information on features that use this command, refer to the Job Scheduler Guide for your switch model.

Command History

Release

Modification

10.08

Command introduced.

Command Information

Platforms

Command context

Authority

All platforms

config

config-job-<NAME>

Administrators or local user group members with execution rights for this command.