The following is an example of automation or lights out operations that you can achieve after configuring a Telnet listener. A shell script is created containing the following command:
#!/bin/sh
host=localhost
port=9023
cmd="info"
( echo open ${host} ${port}
sleep 1
echo "iway"
sleep 1
echo "iway"
sleep 1
echo ${cmd}
sleep 1
echo quit ) | telnet > /home/jay/out.txt
echo " "
echo "* * * command output start * * *"
cat /home/jay/out.txt
echo "* * * command output end * * * *"
echo " "There are other complicated ways of running Telnet on Linux than I/O redirection. For example, the command expect is designed to work with interactive commands.
The following example shows more of the script that can be parameterized as an information-only command which does not affect the behavior or configuration of the server.
* * * command output start * * *
telnet> Trying ::1...
Connected to localhost.
Escape character is '^]'.
User: iway
Password: ****
****************************
*
* iWay Secure Message Broker
* Remote Administration Console
*
* protocol: Telnetd
* engine: base
* iway.serverip: 127.0.1.1
* locale: en_us
* iwayversion: 7.0
* iway.serverhost: UbuntuVM
* iwayworkdir: /iway/prog/7.0.36971/config/base
* iwayconfig: base
* console-master-port: 9999
* iway.pid: 3392
* iway.serverfullhost: UbuntuVM
* iwayhome: /iway/prog/7.0.36971/
* name: Telnet1
* doclocation: config
*
* you are logged in as iway from localhost (0:0:0:0:0:0:0:1)
*
****************************
Enter command:>info
completed failed active workers free
SOAP1
http -- active -- 0 0 0 3 3
file -- active -- 0 0 0 3 3
Telnet1 -- active -- 0 0 1 1 0
Enter command:>quit
goodbye!
* * * command output end * * *
*
| iWay Software |