Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Webcast-Catalyst9k
New Member

Reload command

Hello,

Is it possible to have a router schedule itself to reload every night or once a week?

We have some Cisco 3g wireless routers in remote locations and if we lose connectivity we have to get someone to power cycle the router to get the 3g working again.

I have added an SLA script to the router that pings Google and if it can't it will do a test on the cellular modem which will power cycle that part of the router only which may help.

With a local schedule reload on top of the SLA I'm sure it will be much more reliable.  I have a schedule tool that can do remote reloads but if the router is down then we are stuck and home the SLA works.

Thanks

23 REPLIES

Reload command

Andy,

You can do this with an eem script:

event manager applet ReloadRouter

event timer cron cron-entry "0 0 * * 0"

action 1.0 cli command wr

action 2.0 cli command reload

The above will reload at midnight on Sunday. The fields for 0 0 * * 0 are: minutes, hour, day of month, month, and day of week. Day of week starts on Sunday and is represented by 0 to 6 for Saturday. Time is 24 hour time.

You can also use macros like:

event timer cron cron-entry @weekly name Sunday

This should reload at midnight on Sunday.

HTH,
John

*** Please rate all useful posts ***

HTH, John *** Please rate all useful posts ***
New Member

Reload command

This sounds like just what I need.  I need to restart daily at 5am, woud this be possible?

Also I already have an eem script on there reloading the internal cellular modem, but have no idea if it has been working:

track 234 ip sla 1 reachability

ip sla 1

icmp-echo 10.100.1.66 source-interface Vlan10

frequency 5

ip sla schedule 1 life forever start-time now

event manager applet test

event track 234 state down

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "service internal"

action 4.0 cli command "end"

action 5.0 cli command "test cellular 0 modem-power-cycle"

action 6.0 cli command "config t"

action 7.0 cli command "no service internal"

action 8.0 cli command "end" event manager applet test

Reload command

You should be able to see when the event was triggered with "show event manager history events". If you have entries in there, it's a good chance that your other script has been working.

As far as 5am, absolutely:

event timer cron cron-entry "0 5 * * *"

That should do it.

HTH,
John

*** Please rate all useful posts ***

HTH, John *** Please rate all useful posts ***
New Member

Reload command

So the "*" mean daily?

Looks like the SLA eem script is also working thanks to your commands:

show event manager history events

No.  Job Id Proc Status   Time of Event            Event Type         Name

1    42     Actv success  Fri Feb 7 00:48:07 2014  track              applet: test

2    43     Actv success  Fri Feb 7 00:48:22 2014  track              applet: test

3    46     Actv success  Fri Feb 7 08:08:58 2014  track              applet: test

4    47     Actv success  Fri Feb 7 08:09:13 2014  track              applet: test

Thanks

Reload command

Yes, the * means any. You could also do "0 5 * * 0-6" if that makes you feel more comfortable.

HTH,
John

*** Please rate all useful posts ***

HTH, John *** Please rate all useful posts ***

Re: Reload command

Hello

Here is another example:

reload 16;45 on fridays

========================

"45 16 * * 5" =  "min hour dayofmonth monthofyear dayofweek" (0 = sunday)

event manager applet reload

event timer cron cron-entry "45 16 * * 5"

action 1.0 syslog msg "Router 1 is about to reload"

action 1.1 cli command "enable"

action 1.2 cli command "wr"

action 1.3 reload

#sh event manager policy registered

No.  Class     Type    Event Type          Trap  Time Registered           Name

1    applet    user    timer cron          Off   Fri Feb 7 16:43:57 2014   reload

cron entry {45 16 * * 5}

maxrun 20.000

action 1.0 syslog msg "Router 1 is about to reload"

action 1.1 cli command "enable"

action 1.2 cli command "wr"

action 1.3 reload

res

Paul

Please don't forget to rate any posts that have been helpful.

Thanks.

Please don't forget to rate any posts that have been helpful. Thanks.
New Member

Re: Reload command

Let me take a look guys, so I put the times in as a word?

Router#event timer cron cron-entry ?

  WORD  Cron entry string

Also is the asterix "*" just an ignore?

Thanks

Re: Reload command

Andy,

Basically * is an ignore or just simply put that you don't want a value in that particular field. The cron-entry should be surrounded by quotes as in my previous post.

HTH,
John

*** Please rate all useful posts ***

HTH, John *** Please rate all useful posts ***
New Member

Re: Reload command

Thanks I'm going to test this on a live router as my test one worked, I will use

(config)#event manager applet ReloadRouter

(config-applet)#event timer cron cron-entry "0 5 * * *"

(config-applet)#action 1.0 cli command wr

(config-applet)#action 2.0 cli command reload

I will let you know how it goes!

Once again thanks

Reload command

Hello John

Would that do it on a daily basis?

I thought something like this would be required-

event timer cron cron-entry "0 5 * * @weekly"

res

Paul

Please don't forget to rate any posts that have been helpful.

Thanks.

Please don't forget to rate any posts that have been helpful. Thanks.

Reload command

Paul,

It should. Cron will assume it's every day if there's not a value listed for the day of week field.

You can also use the variable if you want as well as "0-6" for the day, but it should work fine with just the '*'.

HTH,
John

*** Please rate all useful posts ***

HTH, John *** Please rate all useful posts ***

Reload command

Another option that you may have is using regular kron to do this as well:

kron policy-list ReloadRouter

cli wr

cli reload

kron occurrence DailyReload at 05:00 recurring

policy-list ReloadRouter

R1#sh kron schedule

Kron Occurrence Schedule

DailyReload inactive, will run again in 0 days 17:24:38 at 5 :00 on

The 17:24:38 is how many minutes it takes before the next run. So in my example, it's almost 17.5 hours away from 5am.

For what you're wanting to do, this may be easier than running more eem applets.

HTH,
John

*** Please rate all useful posts ***

HTH, John *** Please rate all useful posts ***
New Member

Reload command

I will try both as I am now intrigued

I've just got home and tried both in GNS3 and the commands worked, but nothing happed at the set time I put in.  I guess it could be a limitation of GNS3, I don't have a router at home, so I have to wait to Monday.

eem scripts are somehting I need to really get into, my CCNP didn't really touch on them, must be taught somewhere else.

Reload command

Yeah, GNS doesn't reload routers like you would see on a real router. It just stares at you

HTH,
John

*** Please rate all useful posts ***

HTH, John *** Please rate all useful posts ***

Re: Reload command

Hello

cheers for the verification John

Andy FYI - I posted a weekly emm applet and just noticed you are querying a daily one = @daily

Res
Paul


Sent from Cisco Technical Support iPad App

Please don't forget to rate any posts that have been helpful. Thanks.
New Member

Reload command

Hi,

Did I do something wronf as this example didn't reload the router at 5am, event though it said it did, the show version confirmed this withthe uptime:

event manager applet ReloadRouter

event timer cron cron-entry "0 5 * * *"

action 1.0 cli command "wr"

action 2.0 cli command "reload"

(config-applet)#do sh event mana hist event

No.  Job Id Proc Status   Time of Event                   Event Type            Name

1    1      Actv success    Sat Feb 8 05:00:00 2014  timer cron      applet: ReloadRouter

2    2      Actv success    Sat Feb 8 06:00:15 2014  track             applet: cell_reset

Any ideas?

Re: Reload command

Hello

In your EMM applet - action 2.0 cli command reload

Try this instead and maybe add a day of the week also if applicable to you.

action 2.0 reload

Event manager applet reload
event timer cron cron-entry "0 5 * *6"
action 1.1 cli command "enable"
action 1.2 cli command "wr"
action 1.3 reload

Res
Paul


Sent from Cisco Technical Support iPad App

Please don't forget to rate any posts that have been helpful. Thanks.
New Member

Reload command

Hello,

If I add a day of the week (6) it wouldn't be a daily reboot, or would I need to add each day as a separate action?

Reload command

Andy,

You would need to add 0-6 for a daily reboot. Adding only 6 will reboot it only on Saturday.

HTH,
John

*** Please rate all useful posts ***

HTH, John *** Please rate all useful posts ***
New Member

Re: Reload command

something like this?

Event manager applet reload

event timer cron cron-entry "45 14 * * 0-6"

action 1.1 cli command "enable"

action 1.2 cli command "wr"

action 1.3 reload

seemed it aborted:

4    4      Actv abort    Mon Feb10 14:45:00 2014  timer cron         applet: ReloadRouter

Message was edited by: Andy White

Re: Reload command

Yes, if you're wanting to reload every day at 2:45PM.

Again, if you're doing this in GNS, GNS will not show you a reload. You'd be better off testing another command like shutting down a loopback interface where you'll get some feedback to the console.

HTH,
John

*** Please rate all useful posts ***

HTH, John *** Please rate all useful posts ***
New Member

Re: Reload command

Hi,

This test seemed to work

event manager applet DailyReload

event timer cron cron-entry "0 5 * * *"

action 1.0 reload

New Member

Re: Reload command

For what ever reason this worked:

event manager applet DailyReload

event timer cron cron-entry "0 5 * * *"

action 1.0 reload

But if I use the "cli command" it is ignored.

940
Views
13
Helpful
23
Replies
CreatePlease to create content