Skip navigation
Cisco Learning Home > Learning Center > Assess Your Skills > Discussions

_Communities

3192 Views 0 Replies Latest reply: Feb 25, 2010 6:37 AM by thiyagarajankalaiselvan RSS

Currently Being Moderated

Script to automate router and switch config back-up

Feb 25, 2010 6:37 AM

thiyagarajankalaiselvan 253 posts since
Apr 26, 2009

Dear All,

 

I have attached a script to automate router and switch config back-up.

 

I have downloaded this from a portal. I could not understant the logic of the script.

 

If anybody knows about shell script, please help me know about this script.

 

where to give the device name?

where to give the path to save the file ?

how to schedule it ?

 

hoping for a help.

 

 

#! /bin/sh

DIR=/home/X/router

     if [ ! -e $DIR ]
     then
       mkdir $DIR
     fi

# Tag specification: mmddhhmm
DATE=`date +'%m%d'`
TIME=`date +'%H%M'`
TAG=$DATE$TIME

> $DIR/info.$TAG.report

echo "*******************************************************************************" >> $DIR/info.$TAG.report
echo "*******************************************************************************" >> $DIR/info.$TAG.report
echo "********************************Network Backup Report**************************" >> $DIR/info.$TAG.report
echo "*******************************************************************************" >> $DIR/info.$TAG.report
echo "*******************************************************************************" >> $DIR/info.$TAG.report

for IP_ADDRESS in `cat /home/xxx/router/ipeu`

do

# Collect data from the router
(echo "xx";\
echo "xxx "copy running-config ftp:";\
echo "172.16.2.253";\
echo "\r";\
echo "            exit";\
sleep 10)|telnet $IP_ADDRESS > $DIR/info.$TAG 2>$DIR/info.$TAG.msg

rm $DIR/info.$TAG
rm $DIR/info.$TAG.msg

cat $DIR/info.$TAG.final >> $DIR/info.$TAG.report

echo "*******************************************************************************" >> $DIR/info.$TAG.report
echo "*******************************************************************************" >> $DIR/info.$TAG.report

rm $DIR/info.$TAG.final

done
cat $DIR/info.$TAG.report | mailx -s "Network Backup Report"

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)