Schedule a job to run automatically

A job, that is command, can be scheduled to run on a recurring basis or after certain events. Use the following command to schedule a job:
job <name> at
job <Name> at [HH:]MM [on [MM/]DD] [config-save] <Command-str>
job <Name> at <Event> [config-save] <Command-str>
job

Schedule a command to run automatically in the future.

Name

The name of the job to add or delete.

at

Schedule when the job runs.

reboot

Run the job as soon as possible after every switch boot.

[HH:]MM

The time when the job has to run.

on

Schedule the job to run on specified days.

MM/DD

The date when the job has to run.

<31-1>

The day relative to the end of the month when the job has to run.

<1-31>

The day of the month when the job has to run.

WEEKDAY-LIST

The days of the week when the job has to run.

config-save

Save configuration changes made by the job.

Command-str

The command to execute when this job runs.

NOTE: This command uses a new “weekday list” token type. A weekday list represents one or more days of the week and is stored internally. It allows users to specify a list of individual days or a range of days and use abbreviations. Examples of this weekday list are:
  • Monday, Friday

  • Mon-Wed

  • mo,we-fr,su

Examples

The following example shows a pair of jobs that disable PoE during non-working hours

Switch(config)# job poe-on at 8:00 on mon-fri config-save "interface 1-24 power-over-ethernet"
Switch(config)# job poe-off at 17:00 on mon-fri config-save "no interface 1-24 power-over-ethernet"
The following example shows a job that block access to a server during weekends
Switch(config)# ip access-list extended block-server
Switch(config-ext-nacl)# deny ip any host 10.0.1.80
Switch(config-ext-nacl)# permit ip any any
Switch(config-ext-nacl)# exit
Switch(config)# job allow at 8:00 on mon config-save "no interface 1-24 ip access-group block-server in"
Switch(config)# job deny at 17:00 on fri config-save " interface 1-24 ip access-group block-server in"
The following example shows a job that blinks the Chassis Locate LED when the switch reboots

Switch(config)# job reboot-led at reboot "chassislocate blink"

The following example shows a job that reboots the switch on the first day of each year

Switch(config)# job annual-reboot at 2:00 on 1/1 boot