Command Scheduler (Kron)

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 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

  1. enable
  2. configure terminal
  3. kron policy-list list-name [conditional ]
  4. cli command
  5. exit
  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 }
  7. policy-list list-name
  8. exit
  9. show kron schedule

DETAILED STEPS

  Command or Action Purpose

Step 1

enable

Example:


Device> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2

configure terminal

Example:


Device# configure terminal

Enters global configuration mode.

Step 3

kron policy-list list-name [conditional ]

Example:


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

Example:


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.

  • Each entry is added to the policy list in the order in which it is configured.

  • Repeat this step to add other EXEC CLI commands to a policy list to be executed at the same time or interval.

Note

 

EXEC commands that generate a prompt or can be terminated using keystrokes will cause an error.

Step 5

exit

Example:


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 }

Example:


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

Example:


Device(config-kron-occurrence)# policy-list sales-may

Specifies a Command Scheduler policy list.

  • 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

show kron schedule

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 debug kron 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.


kron policy-list cns-weekly
cli cns image retrieve server http://10.19.2.3/week/ status http://10.19.2.5/status/week/
cli cns config retrieve page /testconfig/config.asp no-persist
exit
kron occurrence week in 7:1:30 recurring
policy-list cns-weekly
policy-list itd-weekly
policy-list mkt-weekly

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

Additional References

Related Documents

Related Topic

Document Title

Cisco IOS commands

Cisco IOS Master Commands List, All Releases

Cisco Networking Services commands: complete command syntax, command mode, command history, defaults, usage guidelines, and examples.

Cisco IOS Cisco Networking Services Command Reference

Cisco Networking Services Configuration Engine

Cisco CNS Configuration Engine Administrator Guide, 1.3

Standards and RFCs

Standard/RFC

Title

No new or modified standards/RFCs are supported by this feature, and support for existing standards/RFCs has not been modified by this feature.

--

MIBs

MIB

MIBs Link

No new or modified MIBs are supported by this feature, and support for existing MIBs has not been modified by this feature.

To locate and download MIBs for selected platforms, Cisco software releases, and feature sets, use Cisco MIB Locator found at the following URL:

http://www.cisco.com/go/mibs

Technical Assistance

Description

Link

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.

http://www.cisco.com/cisco/web/support/index.html

Feature Information for Command Scheduler (Kron)

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 , debug kron , kron occurrence , kron policy-list , policy-list , show kron schedule .

Command Scheduler (Kron) Policy for System Startup

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.