FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


fhscripts:get:get_nw_config.sh.html



Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
fhscripts:get:get_nw_config.sh.html [2017/12/19 02:04]
kurihara created
fhscripts:get:get_nw_config.sh.html [2018/03/29 00:06] (current)
kurihara
Line 1: Line 1:
-~~NOTOC~~ 
 [[:index.html#FastHandle Scripts|FastHandle Scripts]] [[:index.html#FastHandle Scripts|FastHandle Scripts]]
 ====== get_nw_config.sh ====== ====== get_nw_config.sh ======
 +$FHHOME/bin/get_nw_config.sh 
 +\\ 
 +{{INLINETOC}} 
 +\\
  
 ===== How to use ===== ===== How to use =====
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
-$ get_nw_config.sh  srx  x.x.x. test-fw-01 root  password+$ get_nw_config.sh  srx  192.168.0. test-fw-01 root  password
 </sxh> </sxh>
  
  
 \\ \\
-===== Script =====+===== get_nw_config.sh ===== 
 + 
 +$FHHOME/bin/get_nw_config.sh
  
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
Line 19: Line 23:
 # #
 # How to use # How to use
-#     get_nw_config.sh  srx  x.x.x.x  test-fw-01 root  password+#     get_nw_config.sh  srx  x.x.x.x  test-fw-01  root  password
 #=============================================== #===============================================
 + 
 DEVICE=$1 DEVICE=$1
-IP=$2 +NWIP=$2 
-HOSTNAME=$3 +NWHOST=$3 
-USER=$4 +NWUSER=$4 
-PASS=$5+NWPASS=$5 
 +  
 +DATE=`date +%Y%m%d_%H%M` 
 +TFTPSERVER=192.168.0.5 
 +TFTPUSER=user01 
 +TFTPDIR=/home/fasthandle/fhhome/tftp
  
-DATE=`date -d '1day ago' +%Y%m%d` +CONF=${TFTPDIR}/${NWHOST}/${NWHOST}_${DATE}.conf
-TFTPD=/home/fasthandle/fhhome/tftp+
  
-# ------------------------------------------ 
-HELP () { 
  
-cat <<MENU+#---------------------------------------------------------- 
 +[ ! -d "${TFTPDIR}" ] && mkdir ${TFTPDIR} 
 +chmod 777 ${TFTPDIR} 
 + 
 + 
 +#---------------------------------------------------------- 
 +HELP () { 
 +  
 +cat <<@
 How to use How to use
       get_nw_config.sh  srx  x.x.x.x  test-fw-01 root  password       get_nw_config.sh  srx  x.x.x.x  test-fw-01 root  password
-MENU +@ 
 + 
 } }
  
-# ------------------------------------------ 
-GET_SXR () { 
  
 +#-------------------------------------------
 +GET_SRX () {
  
 expect -c " expect -c "
 set timeout 5 set timeout 5
-spawn ssh  ${USER}@${HOST}+spawn ssh  ${NWUSER}@${NWIP}
 expect \"assword:\" expect \"assword:\"
-send \"$PASSWD\r\"+send \"$NWPASSWD\r\"
 expect \"%\" expect \"%\"
 send \"cli\r\" send \"cli\r\"
 expect \">\" expect \">\"
-send \"show configuration | display set | save USER@192.168.0.5:/home/config/test00-fw/tes00-fw_20120714.txt\r\"+send \"show configuration | display set | save ${TFTPUSER}@${TFTPSERVER}:${CONF}\r\" 
 +expect \">\" 
 +send \"exit\r\"
 interact interact
 " "
 } }
 + 
 #=========================================== #===========================================
-case ${NUM} in+case ${DEVICE} in
   -h) HELP   -h) HELP
     ;;     ;;
Line 65: Line 81:
     ;;     ;;
   *) HELP   *) HELP
-     exit 
      ;;      ;;
 esac esac
 +</sxh>
  
  
- 
-</sxh> 
  
 \\ \\
-===== Example Output =====+\\ 
 +<WRAP box 90%> 
 +<catlist ..: -noAddPageButton -smallHead -sortAscending> 
 +</WRAP> 
 +\\ 
 +\\ 
 +[[:index.html#FastHandle Scripts|FastHandle Scripts]]
  
  


fhscripts/get/get_nw_config.sh.html.1513616661.txt.gz · Last modified: 2017/12/19 02:04 by kurihara