Your software release may not support all the features documented in this module. For the latest caveats and feature information, see
Bug Search Tool and the release notes for your platform and software release. To find information about the features documented in this module, and to see a list of the releases in which each feature is supported, see the feature information table at the end of this module.
Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to
www.cisco.com/go/cfn. An account on Cisco.com is not required.
Restrictions for Command Scheduler
The EXEC CLI specified in a Command Scheduler policy list must neither generate a prompt nor can it be terminated using keystrokes. Command Scheduler is designed as a fully automated facility, and no manual intervention is permitted.
Information About Command Scheduler (Kron)
Command Scheduler
The Command Scheduler (KRON) Policy for System Startup feature enables support for the Command Scheduler upon system startup.
The Command Scheduler allows customers to schedule fully-qualified EXEC mode CLI commands to run once, at specified intervals, at specified calendar dates and times, or upon system startup. Originally designed to work with Cisco Networking Services commands, Command Scheduler now has a broader application. Using the Cisco Networking Services image agent feature, remote devices residing outside a firewall or using Network Address Translation (NAT) addresses can use Command Scheduler to launch CLI at intervals, to update the image running in the device.
Command Scheduler has two basic processes. A policy list is configured containing lines of fully-qualified EXEC CLI commands to be run at the same time or same interval. One or more policy lists are then scheduled to run after a specified interval of time, at a specified calendar date and time, or upon system startup. Each scheduled occurrence can be set to run either once only or on a recurring basis.
How to Configure Command Scheduler (Kron)
Configuring Command Scheduler Policy Lists and Occurrences
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.
Before You Begin
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
kronoccurrence 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
showrunning-config command. If a policy list is scheduled to run only once, it will not be displayed by the
showrunning-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
kronoccurrence 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
kronpolicy-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
showrunning-config command after the occurrence has run.
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 thein 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.
Each entry is added to the occurrence list in the order in which it is configured.
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
Example:
Device(config-kron-occurrence)# exit
Exits kron-occurrence configuration mode and returns the device to global configuration mode.
Repeat this step to exit global configuration mode.
Step 9
showkronschedule
Example:
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
Troubleshooting Tips
Use the
debugkron command in privileged EXEC mode to troubleshoot Command Scheduler command operations. Use any debugging command with caution because the volume of output generated can slow or stop the device's operations.
Configuration Examples for Command Scheduler (Kron)
Example: Command Scheduler Policy Lists and Occurrences
In the following example, a Command Scheduler policy named cns-weekly is configured to run two sets of EXEC CLI involving Cisco Networking Services commands. The policy is then scheduled with two other policies to run every seven days, one hour and thirty minutes.
In the following example, a Command Scheduler policy named sales-may is configured to run a Cisco Networking Services command to retrieve a specified image from a remote server. The policy is then scheduled to run only once on May 20, at 6:30 a.m.
kron policy-list sales-may
cli cns image retrieve server 10.19.2.3 status 10.19.2.3
exit
kron occurrence may at 6:30 May 20 oneshot
policy-list sales-may
In the following example, a Command Scheduler policy named image-sunday is configured to run a Cisco Networking Services command to retrieve a specified image from a remote server. The policy is then scheduled to run every Sunday at 7:30 a.m.
kron policy-list image-sunday
cli cns image retrieve server 10.19.2.3 status 10.19.2.3
exit
kron occurrence sunday user sales at 7:30 sunday recurring
policy-list image-sunday
In the following example, a Command Scheduler policy named file-retrieval is configured to run a Cisco Networking Services command to retrieve a specific file from a remote server. The policy is then scheduled to run on system startup.
kron policy-list file-retrieval
cli cns image retrieve server 10.19.2.3 status 10.19.2.3
exit
kron occurrence system-startup
policy-list file-retrieval
The Cisco Support and Documentation website provides online resources to download documentation, software, and tools. Use these resources to install and configure the software and to troubleshoot and resolve technical issues with Cisco products and technologies. Access to most tools on the Cisco Support and Documentation website requires a Cisco.com user ID and password.
The following table provides release information about the feature or features described in this module. This table lists only the software release that introduced support for a given feature in a given software release train. Unless noted otherwise, subsequent releases of that software release train also support that feature.
Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to
www.cisco.com/go/cfn. An account on Cisco.com is not required.
Table 1 Feature Information for Command Scheduler (Kron)
Feature Name
Releases
Feature Information
Command Scheduler (Kron)
Cisco IOS XE Release 2.1
12.3(1)
12.2(33)SRA
12.2(33)SRC
12.2(33)SB
12.2(33)SXI
12.2(50)SY
The Command Scheduler feature provides the ability to schedule some EXEC CLI commands to run at specific times or at specified intervals.
The following commands were introduced or modified by this feature:
cli,
debugkron,
kronoccurrence,
kronpolicy-list,
policy-list,
showkronschedule.
Command Scheduler (Kron) Policy for System Startup
Cisco IOS XE Release 3.8S
12.2(33)SRC
12.2(50)SY
12.2(33)SB
12.4(15)T
The Command Scheduler (Kron) Policy for System Startup feature enables support for the Command Scheduler feature upon system startup.