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  x.x.x.x  test-fw-01 root  password


Script

#!/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
HOSTNAME=$3
USER=$4
PASS=$5

DATE=`date -d '1day ago' +%Y%m%d`
TFTPD=/home/fasthandle/fhhome/tftp

# ------------------------------------------
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 USER@192.168.0.5:/home/config/test00-fw/tes00-fw_20120714.txt\r\"
interact
"
}

#===========================================
case ${NUM} in
  -h) HELP
    ;;
  srx|SRX) GET_SRX
    ;;
  *) HELP
     exit
     ;;
esac




Example Output



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