Bonjour,
J'ai un script qui me permet de sauvegarder mes confs de switchs automatiquement :
#!/usr/bin/expect -f
set type [lindex $argv 0]
set IP [lindex $argv 1]
set name [lindex $argv 2]
set user [lindex $argv 3]
set password [lindex $argv 4]
if {"$type" == "nortel470"} {
spawn telnet $IP
expect "Enter Ctrl-Y to begin."
send "\031"
expect "Enter Password:"
send "$password\r"
expect "IP Configuration/Setup..."
send "C"
expect "#"
send "copy running-config tftp address @IP filename $name-config\r"
expect "#"
send "exit"
}
le script récupère tous ces arguments à partir d'un fichier txt ou sont rentrés tous mes équipements réseaux.
Je voudrais pouvoir placer la date lorsque je récupère ma config en tftp du style :
$name-$madate-config
avec madate = `date +%m%Y`
mais bon ca, ca jne marche pas sous expect !! comment puis-je faire ???
merci de votre aide à tous
++
David
Configuration: Red Hat 5