Toto je starší verze dokumentu!


ÚVOD » tajná oblast CLnet » 3comCiscoHuaweiIPv6LinuxMicrosoftNovellRouterboardVMwareostatní instalaceknihovna


04.01.2015 09:55

Zálohování

backup.sh

#!/bin/sh
 
ARCHIVE="sw-backup.tar.gz"
TFTP="tftp://ip.ad.re.sa"
TFTP_DIR="/srv/tftp"
IP="10.163.8.11
    10.163.8.12
    10.170.2.35
    10.170.2.39"
 
rm -f $TFTP/DIR/*.log
for ip in $IP;
do
 echo $ip
 
/usr/bin/expect -f <<EOD
set timeout 20
 
spawn telnet $IP
 
expect "ame:"
send "username\r"
expect "assword:"
send "password\r"
 
expect "#"
send "copy running-config $TFTP/sw-$IP.cfg\r"
expect "?"
send "\r"
expect "?"
send "\r"
expect "#"
EOD
 
done
 
tar -zcf /tmp/$ARCHIVE $TFTP_DIR/*
uuencode /tmp/$ARCHIVE $ARCHIVE | mail -s "Switches backup" email@email.cz
rm -f /tmp/$ARCHIVE

backupsw.exp

#!/usr/bin/expect -f
set timeout 20

# tftp server
set tftp "10.163.7.180"

# router user name
set name "atmin"

# router password
set pass "heslo"

# start telnet
spawn telnet [lindex $argv 0]

# send username and password
expect "ame:"
send "$name\r"
expect "Password:"
send "$pass\r"

expect "#"
send "copy running-config tftp://$tftp/sw-[lindex $argv 0].cfg\r"

expect "?"
send "\r"
expect "?"
send "\r"
expect "#"
cisco/skript_pro_zalohovani_konfigurace.1361953254.txt.gz · Poslední úprava: 13.03.2020 18:43 (upraveno mimo DokuWiki)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0