How to run a script after powerup

I am looking at running a script after a switch powers up. I have a few lines that I run from bash that helps with a radius/DNS slowness issue. I would love to be able to run this at startup so I don’t have to manually touch each switch after a power event. Any ideas on how I can go about doing this locally on each device? Thanks EOS gurus.

How to keep last X startup configs

If you would like to keep track of last 10 (or more, or less) configuration changes, here’s the event-handler code to do that: event-handler config-versioning    trigger on-startup-config action bash FN=/mnt/flash/startup-config; LFN="`ls -1 $FN.*-* | tail -n 1`"; if [ -z "$LFN" -o -n "`diff -I 'last modified' $FN $LFN`" ]; then cp $FN $FN.`date +%Y%m%d-%H%M%S`; ls -1r $FN.*-* | tail -n +11 | xargs -I % rm %; fi    delay 0 Description: Every time the startup config gets changed, this event handler will be executed (“trigger on-startup-config”). You could increase the delay, if you wish, but now it’s engaged immediately...
Continue reading →

issue using event-handler with bash command

Hi, 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 #!/bin/bash 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/ Leaf1#dir Directory of flash:/ -rwx         154           Feb 19 16:52 -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...
Continue reading →

Script example – Automating VXLAN deployments with EAPI

  1) Introduction This article describes briefly what is required to deploy overlay networks with VXLAN, but we assume a good understanding of the VXLAN fundamentals. To achieve such VXLAN deployments, multiple options exist, from simple but manual, to fully automated service chaining (orchestration) at the cost of having to also set a Cloud Management Platform or a network virtualization controler This article focuses on an easy option that is a good balance between simplicity of operation (automation), and simplicity of  setting up (script ready to go)   2) Working towards automation: it is an evolution This article is not providing...
Continue reading →

How to backup EOS configs to a remote server

This article describes how a switch can push its configuration to a remote server, either on demand or periodically. Automating remote authentication using SSH keys Generate public/private DSA key pair: [root@Arista root]#ssh-keygen -t dsa Enter file in which to save the key (/root/.ssh/id_dsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_dsa. Your public key has been saved in /root/.ssh/ Create an ssh config file for the (in this example) root user. Make sure the formatting is correct. [root@Arista ~]#vi /root/.ssh/config Host * IdentityFile /root/.ssh/id_dsa Copy the public key to the remote...
Continue reading →