This is straight from my router which logins to my modem when it isn't able to ping the gateway.
My modem is configured in zipB but doesn't retain its settings after a reboot. This has been running for more than a year.....
Code:
(sleep 1; echo -e "admin\r"; sleep 1; echo -e "admin\r"; sleep 1; echo -e "zipb set public device WAN\r"; sleep 1; echo -e "user logout\r"; sleep 1; echo -e "exit\r") | telnet 172.19.3.1
It works great for telnet.
ssh doesn't work with the above example (as I found out). plink (ssh for windows) does work. I wrote something in bash for windows like that as well (to automatically configure modems)
If you want to do something more advanced, you should look at "expect"
It will give the appropriate commands at the right moment..
I just finished a script that automatically logins to routers and get their status. It does it using ssh or telnet.
I had a little problem with it, but could finally solve it.
I placed a question here...
Maybe you can get some info out of it...
http://www.linuxquestions.org/questi...t-in-it-735271