Expect script to print out IronPort config, showconfig

Logging this here for easy fetching later.

#!/usr/bin/expect

set timeout 30

spawn ssh USERNAME@HOSTNAME
expect_after eof { exit 0 }

## interact with SSH
expect {
  "yes/no" { send "yes\r" }
  -re ".assword:" { send "PASSWORD\r" }
}

expect "> " { send "showconfig\r" }
expect "> " { send "Y\r" }
expect "Press Any Key For More" { send "\r" }
set timeout 2
while 1 {
  expect {
      "Press Any Key For More" { send "\r" }
      timeout break
  }
}

expect "> " { send "exit\r" }

36 thoughts on “Expect script to print out IronPort config, showconfig”

Comments are closed.