Toto je starší verze dokumentu!
Obsah
Zálohování
backup.sh
#!/bin/sh SCRIPT=/usr/local/bin/backupsw.exp ARCHIVE="constellium-sw-backup.tar.gz" IP="10.163.8.11 10.163.8.12 10.170.2.35 10.170.2.39" rm -f /srv/tftp/*.log for ip in $IP; do echo $ip $SCRIPT $ip >> /srv/tftp/$ip.log done tar -zcf /tmp/$ARCHIVE /srv/tftp/* uuencode /tmp/$ARCHIVE $ARCHIVE | mail -s "Constellium switches backup" mtalman@datron.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 "#"
