cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2347
Views
0
Helpful
6
Replies

Kron run only once at system-startup

j.schouwenburg
Level 1
Level 1

My problem: When a router with a cellulair interface or only the cellular card is replaced in the field this means restoring the saved configuration is not enough to get the box running again, first a few exec commands should be given.

With kron commands in the configuration it is possible to execute exec commands at certain moments or at a certain interval. I want to use this (or another method) to set the cellulair profile settings in the exec mode.

Since 12.4T the kron feauture is extended with the possibility to run on system startup, in addition to the recurring or oneshot occurrences.

Configuring the settings from kron works great, after a reboot of the box the settings are restored. But there is one problem. I only get it to work in a recurring kron schedule. This means that after a reload the commands are directly executed and then in every x minutes, days etc. I don't want this behaviour because this will lead to connectivity loss. The maximum intervall I can choose is 365 days which is far from infinite or never :-)

The manual tell's the format of the cron schedule command is:

kron occurrence occurrence-name [user username] {in [[numdays:] numhours:] nummin | at hours:min [[month] day-of-month] [day-of-week]} {oneshot | recurring | system-startup}

When using "at" the system startup option is not available, when using "in" the maximum time is only 365 days and i can not use a value of 0. Using oneshot will delete the schedule after once running, so next when a config is saved by someone the command is removed from the startup-config. So it seems there is no way to run a exec command only once at every startup with kron. So this is directly a feature request. Solutions: exept 0 for no repeating, except very high values above 365 days or except kron schedules without "in" or "at" (this should in fact already work as it is described in the release notes).

Last but not least, are there any other smart way's to set the cellular profile settings and keep these in the startup-configuration.

My routers don't support EEM, TCL is not handy because of the external storage (flash/tftp). Chat scripts don't seem to work as needed, it looks like executing the cellular profile commands do more than only the chat script commands. Are there any other tricks to solve this deadlock?

Best,

Janno Schouwenburg

6 Replies 6

UgoStorti66
Level 1
Level 1

is a bug ( you can change ios or ...)

https://quickview.cloudapps.cisco.com/quickview/bug/CSCsz57283

it works like oneshot

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

----

kron occurrence remain

kron policy-list is removed in  running config but not in startup config

----

Workaround

reboot at time x ( at 19:00 ?? ): startup config is reladed

http://www.onelumen.com/schedule-daily-restart-of-a-cisco-router/

Enter configuration commands, one per line. End with CNTL/Z.
routerl(config)#kron policy-list reload-router
routerl(config-kron-policy)#cli reload
router(config-kron-policy)#exit
router(config)#kron occurrence reload-router at 4:00 recurring
router(config-kron-occurrence)#policy-list reload-router
router(config-kron-occurrence)#exit
router(config)#exit
router#wr

---

conf t
kron policy-list reload-router
cli reload
exit


kron occurrence reload-router at 4:00 recurring
policy-list reload-router
exit
exit
wr

Hello, I updated IOS to 15.2(2)E9 on my C2960S but kron command still works in the way I don't understand. Is it possible to run kron policy-list on system-startup? How does this construction work "kron occurrence TEST at 11:11 recurring system-startup" ?

Construction described here https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/cns/configuration/15-mt/cns-15-mt-book/cns-cmd-sched.html#GUID-A2BB5F6F-3252-4859-8C2C-50FC480E5EBC 

kron occurrence system-startup

doesn't command at all ("Incomplete command")

So, how does system-startup option works than?

Hello,

 

'kron occurrence TEST at 11:11 recurring system-startup'

 

will run on startup AND each day at 11:11. I don't think you can use Kron to schedule something to run ONLY on startup.

 

EEM would be an alternative, if you use the "@reboot" cron entry, whatever you configure will only run on startup..

 

event manager applet STARTUP

event timer cron cron-entry "@reboot"

Hello,

C2960 doesn't have EEM in OS. So I use Kron

But command

 

'kron occurrence TEST at 11:11 recurring system-startup'

 

run kron occurence only at planned time but not during startup. It shows only:

"Clock currently not set it reads 03:00:43 MSK Mon Jan 2 2006
Kron: Policy Accepted, Policy TEST needs to be configured"

in console during boot.

Tested with write and archive commands in policy-list - no new archive created

 

How to run it on startup (ok let it run periodically but also on startup)

 

Will be glad for any ideas

 

BR Ivan

Hello,

 

which 2960 model do you have, and what IOS version are you running ? I think 15.2(2) or higher supports EEM...

Hello,

this env.

Version 15.2(2)E9

WS-C2960S-48FPS-L

 

SW02#event ?
% Unrecognized command

 

SW02(config)#event ?
% Unrecognized command

 

So, no EEM in my device at all

 

BR Ivan

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Innovations in Cisco Full Stack Observability - A new webinar from Cisco