CCIE or Null!

My journey to CCIE!

Scheduling router jobs utilizing Kron policies.

with one comment

Another very nifty feature that is part of every router (along with Unix system) is the ability to run and schedule Kron jobs. The next question is what can you use these kron jobs for, well you can use them to run privileged level commands on a scheduled basis.

A few examples:

  • Let’s say you want the router to automatically send it’s config to a TFTP or SCP server, create a kron job that will do just that on a weekly basis.
  • Create a kron job that will write the running-config to memory so you don’t have to run the risk of losing your current configuration in the event of a power failure or router reboot.
  • Set a kron job to run on a nightly basis and issue the undebug all command to prevent someone from letting a debug run rampant.
  • The possibilities are almost endless.

Something to keep in mind however is the fact kron jobs cannot be used to make configuration changes, kron cli commands are submitted at the privilege level individually and because they are submitted individually you cannot nest commands to issue commands in global config mode. (You will want to look for a macro for something like that)

Now lets look at what we need to do to create and schedule a kron policy for a Cisco device:

  1. Create the kron policy.
  2. set the commands that are to be issued by the kron policy.
  3. Create the kron occurrence policy.
  4. Specify the re-occurrence schedule.
  5. Specify which kron policy to run under the occurrence schedule.
First we are going to create the kron policy and specify the commands to be issued by this kron policy.

Setting up a kron policy

Now we are going set the schedule for this policy, as well specify which kron policy to run on this occurrence.

Setting the kron policy schedule.

The router will also tell you if the clock is not configured, as you could guess if the date/time on the router is not configured correctly scheduling the kron job could be difficult.

You can view the kron schedule by issuing the following command: sh kron schedule

Viewing the kron schedule

I’ve created a second schedule to run every 2 minutes to the sake of my own time.

You can also debug the kron job to verify it is running successfully:  debug kron all

Kron debug output.

From the debug output you can see the router call the kron job, issue the command in the kron policy, delay the kron job another 2 minutes, and in this case you can see the router write config to memory.

Written by Stephen J. Occhiogrosso

October 17, 2011 at 7:20 AM

One Response

Subscribe to comments with RSS.

  1. build a uasble kron config to do some bacis tasks:
    !+++kron config+++++++++
    kron policy-list kron-b
    cli show start | redirect tftp://
    cli write mem
    cli show run | redirect tftp://
    cli undebug all

    kron occurrence kron-b in 24:00 recurring
    policy-list kron-b


    March 2, 2012 at 1:11 PM

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: