Created
January 18, 2018 13:49
-
-
Save ipcjk/dc6c62b1e9ef3479efaa6c78de8d75b1 to your computer and use it in GitHub Desktop.
Backup HP-switch from bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SWITCHS=\ | |
" | |
foo1:127.0.0.1:g944g4 | |
foo2:127.0.0.2:g944g2 | |
" | |
DATUM=`date +%Y%m%d_%H%M%S` | |
export DATUM | |
BACKUPDIR="~/switchbackups/$DATUM" | |
mkdir -p $BACKUPDIR | |
for SWITCH in $SWITCHS | |
do | |
IFS=':' read -ra ADDR <<< "$SWITCH" | |
echo "Backup ${ADDR[0]}" | |
./save_switch.exp ${ADDR[1]} ${ADDR[2]} > $BACKUPDIR/${ADDR[0]}.config | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment