Scheduling of Router Commands

Problem

You want to issue a command for the router to execute at regularly scheduled times.

Solution

Use the router’s Kron facility to execute commands at regularly scheduled intervals:

Router#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#kron policy-list OREILLY
Router(config-kron-policy)#cli write memory
Router(config-kron-policy)#exit
Router(config)#kron occurrence DAILYat5 at 17:00 recurring
Router(config-kron-occurrence)#policy-list OREILLY
Router(config-kron-occurrence)#end
Router#

Cisco first introduced the Kron facility in IOS Version 12.3(1).

Warning

It is highly recommended that you configure the router with an accurate time source such as NTP or SNTP before configuring the Kron facilities, as it requires an accurate clock to work correctly. See Chapter 14 for more information on NTP and SNTP.

Discussion

The Cisco Kron facility is similar to the Unix Cron facility in that it allows you to schedule commands to be executed at regular intervals. In essence, it allows you to automate certain administrative functions that the router administrator would otherwise have to perform manually. Of course the major advantage is that once configured correctly, the Kron facility issues the commands at the exact time required and without the chance of typos. In addition, it does not require the administrator be present when the commands are run, which is important, especially in organizations with large numbers of ...

Get Cisco IOS Cookbook, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.