An occurrence for Command Scheduler is defined as a scheduled event. Policy lists are configured to run after a specified
interval of time, at a specified calendar date and time, or upon system startup. Policy lists can be run once, as a one-time
event, or as recurring events over time.
Command Scheduler occurrences can be scheduled before the associated policy list has been configured, but a warning will
advise you to configure the policy list before it is scheduled to run.
Perform this task to set up Command Scheduler policy lists of EXEC Cisco Networking Services commands and configure a Command
Scheduler occurrence to specify the time or interval after which the Cisco Networking Services commands will run.
Command Scheduler Policy Lists
Policy lists consist of one or more lines of fully-qualified EXEC CLI commands. All commands in a policy list are executed
when the policy list is run by Command Scheduler using the
kron
occurrence command. Use separate policy lists for CLI commands that are run at different times. No editor function is available, and
the policy list is run in the order in which it was configured. To delete an entry, use the
no form of the
cli command followed by the appropriate EXEC command. If an existing policy list name is used, new entries are added to the end
of the policy list. To view entries in a policy list, use the
show
running-config command. If a policy list is scheduled to run only once, it will not be displayed by the
show
running-config command after it has run.
Policy lists can be configured after the policy list has been scheduled, but each policy list must be configured before it
is scheduled to run.
Command Scheduler Occurences
The clock time must be set on the routing device before a Command Scheduler occurrence is scheduled to run. If the clock
time is not set, a warning message will appear on the console screen after the
kron
occurrence command has been entered. Use the
clock command or Network Time Protocol (NTP) to set the clock time.
The EXEC CLI to be run by Command Scheduler must be tested on the routing device to determine if it will run without generating
a prompt or allowing execution interruption by keystrokes. Initial testing is important because Command Scheduler will delete
the entire policy list if any CLI syntax fails. Removing the policy list ensures that any CLI dependencies will not generate
more errors.
If you use the
conditional keyword with the
kron
policy-list command, execution of the commands will stop when an error is encountered.
Note |
- No more than 31 policy lists can be scheduled to run at the same time.
- If a one-time occurrence is scheduled, the occurrence will not be displayed by the
show
running-config command after the occurrence has run.
>
|
SUMMARY STEPS
-
enable
-
configure
terminal
-
kron
policy-list
list-name
[conditional ]
-
cli
command
-
exit
-
kron
occurrence
occurrence-name
[user
username ] {in [[numdays: ]numhours: ]nummin |
at
hours:min [[month ]
day-of-month ] [day-of-week ]} {oneshot |
recurring |
system-startup }
-
policy-list
list-name
-
exit
-
show
kron
schedule
DETAILED STEPS
|
Command or Action |
Purpose |
Step 1 |
enable
|
Enables privileged EXEC mode.
|
Step 2 |
configure
terminal
Device# configure terminal
|
Enters global configuration mode.
|
Step 3 |
kron
policy-list
list-name
[conditional ]
Device(config)# kron policy-list cns-weekly
|
Specifies a name for a new or existing Command Scheduler policy list and enters kron-policy configuration mode.
-
If the
list-name is new, a new policy list structure is created.
-
If the
list-name exists, the existing policy list structure is accessed. The policy list is run in configured order with no editor function.
-
If the optional
conditional keyword is used, execution of the commands stops when an error is encountered.
|
Step 4 |
cli
command
Device(config-kron-policy)# cli cns image retrieve server https://10.19.2.3/cnsweek/ status https://10.19.2.3/cnsstatus/week/
|
Specifies the fully-qualified EXEC command and associated syntax to be added as an entry in the specified Command Scheduler
policy list.
Note
|
EXEC commands that generate a prompt or can be terminated using keystrokes will cause an error.
|
|
Step 5 |
exit
Device(config-kron-policy)# exit
|
Exits kron-policy configuration mode and returns the device to global configuration mode.
|
Step 6 |
kron
occurrence
occurrence-name
[user
username ] {in [[numdays: ]numhours: ]nummin |
at
hours:min [[month ]
day-of-month ] [day-of-week ]} {oneshot |
recurring |
system-startup }
Device(config)# kron occurrence may user sales at 6:30 may 20 oneshot
|
Specifies a name and schedule for a new or existing Command Scheduler occurrence and enters kron-occurrence configuration
mode.
-
Use the
in keyword to specify a delta time interval with a timer that starts when this command is configured.
-
Use the
at keyword to specify a calendar date and time.
-
Choose either the
oneshot or
recurring keyword to schedule Command Scheduler occurrence once or repeatedly. Add the optional
system-startup keyword for the occurrence to be at system startup.
|
Step 7 |
policy-list
list-name
Device(config-kron-occurrence)# policy-list sales-may
|
Specifies a Command Scheduler policy list.
Note
|
If the CLI commands in a policy list generate a prompt or can be terminated using keystrokes, an error will be generated
and the policy list will be deleted.
|
|
Step 8 |
exit
Device(config-kron-occurrence)# exit
|
Exits kron-occurrence configuration mode and returns the device to global configuration mode.
|
Step 9 |
show
kron
schedule
Device# show kron schedule
|
(Optional) Displays the status and schedule information of Command Scheduler occurrences.
|
Examples
In the following example, output information is displayed about the status and schedule of all configured Command Scheduler
occurrences:
Device# show kron schedule
Kron Occurrence Schedule
cns-weekly inactive, will run again in 7 days 01:02:33
may inactive, will run once in 32 days 20:43:31 at 6:30 on May 20