2015年8月19日 星期三

Linux ---backup Cisco Switch devices script

[root@localhost nedi]# more switch.sh
#!/bin/sh


#IP address 172.19.253.1
    # usage: rtrbackup <router ip>
    #
    # user='XXXX'
     password='XXXX'
     en="en"
     enable_mode='enable'
     enable_password=enable password
 # Directory where the log files will be stored
     #
     DIR=/var/nedi/Backup
    ########################################
  # Tag specification: mmddhhmm
     DATE=`date +'%y%m%d'`
     TIME=`date +'%H%M'`
     TAG=$DATE
     echo "Switch back up complete  $(date) $1" >> /var/nedi/Backup/back.log
     # Collect data from the router
     (sleep 5; echo $password; echo $en; echo $enable_password; echo "term length 0"; echo "show running-confi"; echo "exit";sleep 10)|telnet $1 >$DIR/$1.$TAG


crontab -l

8 0 1 * * /var/nedi/OCswitch.sh 172.18.253.7

沒有留言:

張貼留言