Lidt test fra Ubuntu

Ref: http://superuser.com/questions/670866/feeding-contents-of-a-text-file-as-command-to-telnet

expect - programmed dialogue with interactive programs

Ref: http://manpages.ubuntu.com/manpages/natty/man1/expect.1.html

List alle forbrugsregistrende devices

#!/usr/bin/expect
spawn telnet 10.0.0.110 10001
expect "'^]'."
send ">>Login 32010<<\r"
expect ">>Login Ok<<"
send ">>Get Devices<<\r"
sleep .5;
send ">>Logout\r"
exit

Tænd et Device

Her tænder vi for 10601

 #!/usr/bin/expect
spawn telnet 10.0.0.110 10001
expect "'^]'."
send ">>Login 32010<<\r"
expect ">>Login Ok<<"
sleep .1;
send ">>Set 10604 1<<"
sleep .1;
send ">>Logout\r"
exit