There are multiple ways you can automate the work on cisco device ( Router, Switch ), Kron is one of the useful tool:

Kron

 

If you have touched the crontab in Linux, Cisco kron is doing similar job.

create a policy list

First step is create a kron policy-list, which tells the device what command to issue. I will create a task to backup the running configure of switch in K13 office to a tftp server with IP 192.168.17.98:

conf t
  kron policy-list BU-CONF
    cli copy run tftp://192.168.17.98/K13office_01
Schedule this policy:

1. configure this schedule to be weekly at 00:00 sunday:

(config)#kron occurrence BU-CONF-WEEKLY at 00:00 SUN recurring

2. Tell the schedule which policy to run:

(config-kron-occurrence)#policy-list BU-CONF

This can be useful if your NAT table get flooded if you open some service to Internet, so you can schedule the command clear ip nat translation * at a regular interval.

 

Event manager

With Event manager, you

conf t
 event manager applet CLEAR-NAT-TABLE
   event timer cron cron-entry "* 10 * * 1-5"
   action 1 cli command "enable"
   action 2 cli command "clear ip nat translation *"
   action 3 cli command "send log 5 'NAT table cleared'"

This will create a event runs at 10 monday to Friday, it will enable the privilege mode, then clear the NAT table, and send a notice message: “NAT table cleared” .

Note that, you need to use single quotation and double quotation

 

Reference

https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/cns/configuration/xe-16-5/cns-xe-16-5-book/cns-cmd-sched.html