FastHandle is fast operation tools for infrastructure configurations and tests.
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
fhscripts:get:get_nw_config.sh.html [2017/12/20 00:25] kurihara |
fhscripts:get:get_nw_config.sh.html [2018/03/29 00:06] (current) kurihara |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ~~NOTOC~~ | ||
| [[: | [[: | ||
| ====== get_nw_config.sh ====== | ====== get_nw_config.sh ====== | ||
| + | $FHHOME/ | ||
| + | \\ | ||
| + | {{INLINETOC}} | ||
| + | \\ | ||
| ===== How to use ===== | ===== How to use ===== | ||
| Line 12: | Line 14: | ||
| \\ | \\ | ||
| ===== get_nw_config.sh ===== | ===== get_nw_config.sh ===== | ||
| + | |||
| + | $FHHOME/ | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| Line 23: | Line 27: | ||
| DEVICE=$1 | DEVICE=$1 | ||
| - | IP=$2 | + | NWIP=$2 |
| - | HOST=$3 | + | NWHOST=$3 |
| - | USER=$4 | + | NWUSER=$4 |
| - | PASS=$5 | + | NWPASS=$5 |
| DATE=`date +%Y%m%d_%H%M` | DATE=`date +%Y%m%d_%H%M` | ||
| - | TSERVER=192.168.0.5 | + | TFTPSERVER=192.168.0.5 |
| - | TUSER=user01 | + | TFTPUSER=user01 |
| - | TDIR=/ | + | TFTPDIR=/ |
| + | CONF=${TFTPDIR}/ | ||
| - | # ------------------------------------------ | + | #---------------------------------------------------------- |
| - | [ ! -d "${TDIR}" ] && mkdir ${TDIR} | + | [ ! -d "${TFTPDIR}" ] && mkdir ${TFTPDIR} |
| - | chmod 777 ${TDIR} | + | chmod 777 ${TFTPDIR} |
| - | # ------------------------------------------ | + | #---------------------------------------------------------- |
| HELP () { | HELP () { | ||
| - | cat <<MENU | + | cat <<@ |
| How to use | How to use | ||
| get_nw_config.sh | get_nw_config.sh | ||
| - | MENU | + | @ |
| } | } | ||
| Line 52: | Line 57: | ||
| # | # | ||
| - | GET_SXR | + | GET_SRX |
| expect -c " | expect -c " | ||
| set timeout 5 | set timeout 5 | ||
| - | spawn ssh ${USER}@${HOST} | + | spawn ssh ${NWUSER}@${NWIP} |
| expect \" | expect \" | ||
| - | send \"$PASSWD\r\" | + | send \"$NWPASSWD\r\" |
| expect \" | expect \" | ||
| send \" | send \" | ||
| expect \"> | expect \"> | ||
| - | send \"show configuration | display set | save ${TUSER}@${TSERVER}:${TDIR}/ | + | send \"show configuration | display set | save ${TFTPUSER}@${TFTPSERVER}:${CONF}\r\" |
| + | expect \"> | ||
| + | send \"exit\r\" | ||
| interact | interact | ||
| " | " | ||
| Line 68: | Line 75: | ||
| # | # | ||
| - | case ${NUM} in | + | case ${DEVICE} in |
| -h) HELP | -h) HELP | ||
| ;; | ;; | ||
| Line 78: | Line 85: | ||
| </ | </ | ||
| + | |||
| + | |||
| + | \\ | ||
| + | \\ | ||
| + | <WRAP box 90%> | ||
| + | <catlist ..: -noAddPageButton -smallHead -sortAscending> | ||
| + | </ | ||
| + | \\ | ||
| + | \\ | ||
| + | [[: | ||
My Sites
SNS
Copyright (c) 2025 FastHandle - IT Operations Examples All Rights Reserved.