Scheduling tasks in Cisco IOS

2010-01-31

This is a quick start guide for how to configure the scheduling of switches and routers from Cisco. These functions may differ between different models and IOS. For example, scheduling can be used to save a daily backup of the configuration or to import a new, fresh configuration on a regular basis. This method may save some trouble and manual labor for the network administrator.

The first step is to create a list of commands to execute at a given time. The configuration below is an example of how to create such a list. <c_name> is a unique name that will identify the list. <command> is a command to execute. You can use multiple commands in a row, it is just to write them one after another. Remember that all commands here will begin with “cli”. The list is terminated by typing “exit”.

Router(config)# kron policy-list <c_name>
Router(config-kron-policy)# cli <command>
Router(config-kron-policy)# exit

In order to schedule the execution of the command list we just created, you can use the following configuration. <s_name> is a unique name for the schedule and it should not be confused with the name of the command list. In this example, we want <c_name> to run at a certain hour every day. “Recurring” means that there will be a recurring event. If you want it to only run once, you can exchange it for “oneshot”. For more detailed information on how to set the dates, use the link at the end of the guide.

Router(config)# kron occurrence <s_name> at <hh:mm> recurring
Router(config-kron-occurence)# policy-list <c_name>
Router(config-kron-occurence)# exit

You can use the following command to confirm that the scheduling is correct.

Router# show kron schedule

One thing to keep in mind when scheduling tasks on Cisco is that the machine’s clock probably is incorrect if you haven’t used time dependant functions before. You can check the current time and change it if needed with the following commands:

Router# show clock
Router# clock set hh:mm:ss day month year

This is just a quick start guide and doesn’t cover all the functionality of kron. For mor information, visit Cisco’s page for kron.