I run vEOS 4.13.7M in VirtualBox. Inspired by the logGrab bash script provided here on EOS Central I wrote this tiny little script
FILENAME=startup-config_$HOSTNAME_$(date +%Y-%m-%d.%H%M%S) cd /mnt/flash cp startup-config $FILENAME
Invoked from CLI it works like a charm, producing lots of config files to fill my flash:
Leaf1#bash /mnt/flash/archive_startup_configs.sh Leaf1#dir Directory of flash:/
-rwx 154 Feb 19 16:52 archive_startup_configs.sh -rwx 20 Jun 16 2014 boot-config drwx 4096 Aug 22 2014 debug drwx 4096 Feb 19 07:44 persist drwx 4096 Aug 22 2014 schedule -rwx 1062 Feb 19 16:53 startup-config -rwx 1062 Feb 19 16:26 startup-config_2015-02-19.162615 -rwx 1062 Feb 19 16:32 startup-config_2015-02-19.163234 -rwx 1062 Feb 19 16:32 startup-config_2015-02-19.163240 -rwx 1062 Feb 19 16:51 startup-config_2015-02-19.165112 -rwx 1062 Feb 19 16:52 startup-config_2015-02-19.165243 -rwx 1062 Feb 19 16:52 startup-config_2015-02-19.165257 -rwx 1062 Feb 19 22:43 startup-config_2015-02-19.224341 -rwx 203152416 Jun 16 2014 vEOS.swi -rwx 13 Oct 7 2014 zerotouch-config
1938747392 bytes total (1530761216 bytes free)
Unfortunatley when I configure event-handler to start the script on startup-config changes it produces an ACTION_FAILED event…
event-handler ARCHIVE_STARTUP trigger on-startup-config action bash /mnt/flash/archive_startup_config.sh
Leaf1#write mem Copy completed successfully. Leaf1#show event-handler Event-handler ARCHIVE_STARTUP Trigger: on-startup-config delay 20 seconds Action: /mnt/flash/archive_startup_config.sh Action expected to finish in less than 10 seconds Last Trigger Activation Time: 9 seconds ago Total Trigger Activations: 2 Last Action Time: 2 minutes 31 seconds ago Total Actions: 1
Leaf1#show log last 1 minutes Feb 20 12:57:05 Leaf1 Cli: %SYS-5-CONFIG_STARTUP: Startup config saved from system:/running-config by nik on vty3 (10.0.0.1). Feb 20 12:57:25 Leaf1 EventMgr: %SYS-6-EVENT_TRIGGERED: Event handler ARCHIVE_STARTUP was activated Feb 20 12:57:25 Leaf1 EventMgr: %SYS-5-EVENT_ACTION_FAILED: Event handler action ARCHIVE_STARTUP did not complete with exit code 0: Action returned with exit code 127
Not being much of a script kiddy I would assume my script is messed up but since it runs perfectly when envoked manually I doubt that. Do you have any suggestions?
Thanks in advance and best regards everybody!
The error code you’re getting (Action returned with exit code 127) means the command was not found.
Looking at your action, you’re calling
(extra S after config). If you change that your event handler should work.
Wow, that was stupid… Now I’m sorry for the question, but you wouldn’t believe how long I tried to solve this issue without realizing the typo. Thank you very much!
Post your Answer
You must be logged in to post an answer.