06-27-2011 05:51 AM - edited 03-07-2019 12:59 AM
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
Solved! Go to Solution.
06-28-2011 11:19 AM
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
06-28-2011 12:06 PM
Did it fix your issue? You marked it correct, but then you said it didn't work.
06-27-2011 06:36 AM
Hi,
action 2.0 if $_string_result eq -1
Isn't this a typo? it shoulb be $_cli_result instead, no?
Regards.
Alain.
06-27-2011 08:14 AM
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.
06-27-2011 08:30 AM
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
06-27-2011 08:56 AM
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!!!
06-28-2011 06:53 AM
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
06-28-2011 10:26 AM
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.
06-28-2011 11:19 AM
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
06-28-2011 12:02 PM
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
06-28-2011 12:06 PM
Did it fix your issue? You marked it correct, but then you said it didn't work.
06-28-2011 12:13 PM
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.
06-28-2011 12:16 PM
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
06-28-2011 01:34 PM
Not yet!
accept de command but with reload in or not, it continues exit!
06-29-2011 08:13 AM
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
07-01-2011 07:31 AM
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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide