FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


Sidebar


Top     SiteMap

Manager Server

Target Server

$FHHOME/bin/xxx.sh | xxxx.exp













.

fhscripts:get:get_nw_config.sh.html



This is an old revision of the document!



FastHandle Scripts

get_nw_config.sh

How to use

$ get_nw_config.sh  srx  192.168.0.5  test-fw-01 root  password


get_nw_config.sh

#!/bin/bash
#===============================================
# get_nw_config.sh
#
# How to use
#     get_nw_config.sh  srx  x.x.x.x  test-fw-01  root  password
#===============================================
 
DEVICE=$1
NWIP=$2
NWHOST=$3
NWUSER=$4
NWPASS=$5
 
DATE=`date +%Y%m%d_%H%M`
TSERVER=192.168.0.5
TUSER=user01
TDIR=/home/fasthandle/fhhome/tftp

CONF=${TDIR}/${NWHOST}/${NWHOST}_${DATE}.conf

# ------------------------------------------
[ ! -d "${TDIR}" ] && mkdir ${TDIR}
chmod 777 ${TDIR}


# ------------------------------------------
HELP () {
 
cat <<MENU
How to use
      get_nw_config.sh  srx  x.x.x.x  test-fw-01 root  password
MENU
 
}


#-------------------------------------------
GET_SXR () {

expect -c "
set timeout 5
spawn ssh  ${NWUSER}@${NWIP}
expect \"assword:\"
send \"$NWPASSWD\r\"
expect \"%\"
send \"cli\r\"
expect \">\"
send \"show configuration | display set | save ${TUSER}@${TSERVER}:${CONF}\r\"
expect \">\"
send \"exit\r\"
interact
"
}
 
#===========================================
case ${DEVICE} in
  -h) HELP
    ;;
  srx|SRX) GET_SRX
    ;;
  *) HELP
     ;;
esac








FastHandle Scripts



fhscripts/get/get_nw_config.sh.html.1513697596.txt.gz ยท Last modified: 2017/12/20 00:33 by kurihara