diff --git a/usr/local/bin/custom/poe.sh b/usr/local/bin/custom/poe.sh index 5287810..ede9c80 100644 --- a/usr/local/bin/custom/poe.sh +++ b/usr/local/bin/custom/poe.sh @@ -52,24 +52,13 @@ expect { "assword:" { send "$password\r"; exp_continue } "Press any key" { send "\r"; exp_continue } -re ".*> $" { } - timeout { exit 1 } - eof { exit 1 } } send "configure terminal\r" -expect { - "(config)#" { } - timeout { exit 1 } -} +expect "(config)#" send "interface $switch_port\r" -expect { - "(eth-$switch_port)#" { } - timeout { exit 1 } -} +expect "(eth-$switch_port)#" send "no power-over-ethernet\r" -expect { - "(eth-$switch_port)#" { } - timeout { exit 1 } -} +expect "(eth-$switch_port)#" send "exit\r" expect "(config)#" send "exit\r" @@ -78,7 +67,6 @@ send "exit\r" expect ">"; send "exit\r" expect "Do you want to log out (y/n)?" { send "y\r" } expect eof -exit 0 EOF } @@ -95,24 +83,13 @@ expect { "assword:" { send "$password\r"; exp_continue } "Press any key" { send "\r"; exp_continue } -re ".*> $" { } - timeout { exit 1 } - eof { exit 1 } } send "configure terminal\r" -expect { - "(config)#" { } - timeout { exit 1 } -} +expect "(config)#" send "interface $switch_port\r" -expect { - "(eth-$switch_port)#" { } - timeout { exit 1 } -} +expect "(eth-$switch_port)#" send "power-over-ethernet\r" -expect { - "(eth-$switch_port)#" { } - timeout { exit 1 } -} +expect "(eth-$switch_port)#" send "exit\r" expect "(config)#" send "exit\r" @@ -121,7 +98,6 @@ send "exit\r" expect ">"; send "exit\r" expect "Do you want to log out (y/n)?" { send "y\r" } expect eof -exit 0 EOF }