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
IP=$2
HOST=$3
USER=$4
PASS=$5
 
DATE=`date +%Y%m%d_%H%M`
TSERVER=192.168.0.5
TUSER=user01
TDIR=/home/fasthandle/fhhome/tftp



# ------------------------------------------
[ ! -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  ${USER}@${HOST}
expect \"assword:\"
send \"$PASSWD\r\"
expect \"%\"
send \"cli\r\"
expect \">\"
send \"show configuration | display set | save ${TUSER}@${TSERVER}:${TDIR}/${HOST}/${HOST}_${DATE}.conf\r\"
interact
"
}
 
#===========================================
case ${NUM} in
  -h) HELP
    ;;
  srx|SRX) GET_SRX
    ;;
  *) HELP
     ;;
esac








FastHandle Scripts



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