Alexandra Stanovska wrote an excellent comment to my Schedule reload before configuring the router post:
It may come in handy creating some form of script that would display some basic upon logout - show debug, show reload etc.
The new capabilities of CLI event detector introduced in EEM 3.0 allow us to catch CLI commands in a particular parser mode. Writing an EEM applet that catches exec-mode exit or logout and performs a few checks is thus a trivial task.
The following applet is a proof of concept; it checks whether a reload is scheduled and prevents the user from exiting a telnet session before cancelling the scheduled reload. Feel free to extend it and add other checks you’d like to see performed.
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