Read the following article to find out where you can get Expect:
HOW TO: Perform Automated Tasks on Digi device and Terminal Server Products Automatically Without User Intervention
Then create the following script:
# Run the expect interpreter.
#!/usr/bin/expect
#
# save this file as expect_flusharp
# and chmod +x expect_flusharp
# and put it somewhere in your path
# the command line syntax for this program is
# expect_flusharp ip.of.port.server
#
# this program flushes the arp buffer on a portserver
# which can be helpful in constructing a failover scenario
# for allowing an second server to gain access to the
# ports which where previously controlled by a first server
# when both servers share the same IP address and the second one
# is coming in as a failover server
#
#
#Set up line argument for the enterd ip address.
set ip [lindex $argv 0]
# Set the telnet_out variable to octal equivalent of ^]
set telnet_out \035
# Telnet to the appropriate IP address.
spawn telnet $ip
expect "login: "
send "root\r"
expect "password: "
send "dbps\r"
expect "#> "
send "set arp rmarp=on *\r"
expect "#> "
send $telnet_out
set timeout -1
expect "telnet> "
send "quit\r"
close;wait
Last updated:
Jan 09, 2024