cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1440
Views
0
Helpful
16
Replies

Cannot allow you to exit, reload is scheduled (TCL Sript)

silviorodrigues
Level 1
Level 1
Dears I trie run this script below, but is not work !
When I do reload in xx and trie exit from router, ok it says: "Cannot allow you to exit, reload is scheduled",
then a do reload cancel, but it contuinues saying that "Cannot allow you to exit, reload is scheduled" and I cant´t logout from router!

My equipment is a Router Cisco 2801 with IOS 12.4.24!

Please, help-me solve this!!!

===============This is the Scritp====================

event manager applet CheckScheduledReloadOnExit
event cli pattern "^(ex|logo)" mode "exec" enter maxrun 1
action 1.0 cli command "show reload"
action 1.1 string first "No reload is scheduled" "$_cli_result"
action 2.0 if $_string_result eq -1
action 2.1  puts "Cannot allow you to exit, reload is scheduled"
action 2.2 else
action 2.3  set _exit_status 1
action 2.9 end
2 Accepted Solutions

Accepted Solutions

Apologies for the typo above (action 1.1 action). Try This:

event manager applet CheckScheduledReloadOnExit

no action 2.2

no action 2.3

no action 2.9

action 2.2 set_exit_status "0"

action 2.3 else

action 2.4 set_exit_status "1"

action 2.5 end

End result should be:

event manager applet CheckScheduledReloadOnExit

event cli pattern "^(ex|logo)" mode "exec" enter maxrun 1

action 1.0 cli command "show reload"

action 1.1 string first "No reload is scheduled" "$_cli_result"

action 2.0 if $_string_result eq -1

action 2.1  puts "Cannot allow you to exit, reload is scheduled"

action 2.2 set _exit_status "0"

action 2.3 else

action 2.4 set _exit_status "1"

action 2.5 end

Message was edited by: Antonio Knox

View solution in original post

Did it fix your issue?  You marked it correct, but then you said it didn't work.

View solution in original post

16 Replies 16

cadet alain
VIP Alumni
VIP Alumni

Hi,

action 2.0 if $_string_result eq -1

Isn't this a typo? it shoulb be   $_cli_result  instead, no?

Regards.

Alain.

Don't forget to rate helpful posts.

The problem still continues!

LooK

event manager applet CheckScheduledReloadOnExit

event cli pattern "^(ex|logo)" mode "exec" enter maxrun 1

action 1.0 cli command "show reload"

action 1.1 string first "No reload is scheduled" "$_cli_result"

action 2.0 if $_string_result eq -1

action 2.1  puts "Cannot allow you to exit, reload is scheduled"

action 2.2 else

action 2.3  set _exit_status "1"

action 2.9 end

Test 1:

br-sao-co1-rta-cm01#show reload

Reload scheduled for 12:21:13 UTC Mon Jun 27 2011 (in 9 minutes) by srodrigues on vty0 (XXXX)

Reload reason: Reload Command

br-sao-co1-rta-cm01#exit

Cannot allow you to exit, reload is scheduled

Its good

Test 2:

br-sao-co1-rta-cm01#reload cancel

br-sao-co1-rta-cm01#exit

Cannot allow you to exit, reload is scheduled

continues not working

Please continue help me!!!

***

*** --- SHUTDOWN ABORTED ---

***

br-sao-co1-rta-cm01#sh relo

br-sao-co1-rta-cm01#sh reload

No reload is scheduled.

Silvio Rodrigues wrote:

The problem still continues!

LooK

event manager applet CheckScheduledReloadOnExit

event cli pattern "^(ex|logo)" mode "exec" enter maxrun 1

action 1.0 cli command "show reload"

action 1.1 string first "No reload is scheduled" "$_cli_result"

action 2.0 if $_string_result eq -1

action 2.1  puts "Cannot allow you to exit, reload is scheduled"

action 2.2 else

action 2.3  set _exit_status "1"

action 2.9 end

You still have not made the change suggested by Alain. Do this

config t

event manager applet CheckScheduledReloadOnExit

no action 2.0

action 2.0 if $_cli_result eq -1

end

hello guys!

The problem still continues!

Look!

event manager applet CheckScheduledReloadOnExit

event cli pattern "^(ex|logo)" mode "exec" enter maxrun 1

action 1.0 cli command "show reload"

action 1.1 string first "No reload is scheduled" "$_cli_result"

action 2.0 if $_cli_result eq -1

action 2.1  puts "Cannot allow you to exit, reload is scheduled"

action 2.2 else

action 2.3  set _exit_status "1"

action 2.9 end

Now it´s exit even with reload in XX

Look:

show reload

Reload scheduled for 12:59:21 UTC Mon Jun 27 2011 (in 6 minutes) by srodrigues on vty0 (XXXX)

Reload reason: Reload Command

br-sao-co1-rta-cm01#exit

Connection closed by foreign host.

srodrigues@ger02:/home/backup-equipa

Please help again!!!

Make the following changes.  Try creating an action for the string comparison and switching back to $_string_result.

conf t

event manager applet CheckScheduledReloadOnExit

no action 1.1

action 1.1 action string first "No reload is scheduled" "$_cli_result"

no action 2.0

action 2.0 if $_string_result eq -1

end

show run | b event manager applet Check

Output should look like this:

event manager applet CheckScheduledReloadOnExit

event cli pattern "^(ex|logo)" mode "exec" enter maxrun 1

action 1.0 cli command "show reload"

action 1.1 action string first "No reload is scheduled" "$_cli_result"

action 2.0 if $_string_result eq -1

action 2.1  puts "Cannot allow you to exit, reload is scheduled"

action 2.2 else

action 2.3  set _exit_status "1"

action 2.9 end

Antonio good morning!

Thanks for your trie help-me!

Not yet!!!

Look!

- show runn

event manager applet CheckScheduledReloadOnExit

event cli pattern "^(ex|logo)" mode "exec" enter maxrun 1

action 1.0 cli command "show reload"

action 1.1 string first "No reload is scheduled" "$_cli_result"

action 2.0 if $_string_result eq -1

action 2.1  puts "Cannot allow you to exit, reload is scheduled"

action 2.2 else

action 2.3  set _exit_status "1"

action 2.9 end

- show reload:

br-sao-co1-rta-cm01#show reload

No reload is scheduled.

- Trie exit

br-sao-co1-rta-cm01#show reload

No reload is scheduled.

Apologies for the typo above (action 1.1 action). Try This:

event manager applet CheckScheduledReloadOnExit

no action 2.2

no action 2.3

no action 2.9

action 2.2 set_exit_status "0"

action 2.3 else

action 2.4 set_exit_status "1"

action 2.5 end

End result should be:

event manager applet CheckScheduledReloadOnExit

event cli pattern "^(ex|logo)" mode "exec" enter maxrun 1

action 1.0 cli command "show reload"

action 1.1 string first "No reload is scheduled" "$_cli_result"

action 2.0 if $_string_result eq -1

action 2.1  puts "Cannot allow you to exit, reload is scheduled"

action 2.2 set _exit_status "0"

action 2.3 else

action 2.4 set _exit_status "1"

action 2.5 end

Message was edited by: Antonio Knox

Not yet!!!

Look!

action 2.2 set_exit_status "0"

% Invalid input detected at '^' marker.

action 2.2 set_exit_status "0"

% Invalid input detected at '^' marker.

Thanks

Did it fix your issue?  You marked it correct, but then you said it didn't work.

Oh excuse-me!!!

Not working yet;

look

this lines is not accept!

action 2.2 set_exit_status "0"

% Invalid input detected at '^' marker.

action 2.2 set_exit_status "0"

% Invalid input detected at '^' marker.

I forgot to add the space between the word "set" and "_"

event manager applet CheckScheduledReloadOnExit

no action 2.2

no action 2.3

no action 2.9

action 2.2 set _exit_status "0"

action 2.3 else

action 2.4 set _exit_status "1"

action 2.5 end

Not yet!

accept de command but with reload in or not, it continues exit!

OK, I would like to make sure that the applet is running BEFORE the command is executed and not parallel so we'll set the sync option to yes.  Then we need to verify that the "string first" comparison is returning a proper value.  Do the following

event manager applet CheckScheduledReloadOnExit

no event cli pattern "^(ex|logo)" mode "exec" enter maxrun 1

event cli pattern "^(ex|logo)" mode "exec" enter maxrun 1 sync yes

action 1.2 puts "$_string_result"

This will add a little bit to your output for the sake of being certain of the problem, but at least we will know where to finish troubleshooting.

Message was edited by: Antonio Knox

Antonio good morning

this command is not accept, look!

br-sao-co1-rta-cm01(config-applet)#event cli pattern "^(ex|logo)" mode "exec" enter maxrun 1 sync yes

% Invalid input detected at '^' marker.

Thanks

Review Cisco Networking for a $25 gift card