Kleines Expect-Script für alte Cisco Switches un err-disabled

Expect-Script

#!/usr/bin/expect

set host [lindex $argv 0]

spawn telnet $host
expect „Password:“
send „YourPassword\n“
log_file ./err-status-$host.log

send „term len 0\n“
send „show int status err-disabled\n“
expect „end\r“
send „\n“
send „exit\n“
log_file

Bash-Wrapper

cat check-state.sh
/usr/bin/expect ./check-state.expect 1.2.3.4
sleep 2
/usr/bin/expect ./check-state.expect 1.2.3.5
sleep 2

Schreibe einen Kommentar