Automated Telnet Login
I am trying to write an automated script which will do an automated telnet login, execute a few commands, and then exit but I can't seem to get it to work.
The reason that I want to do this is my ADSL router locks up every few weeks and I then need to power it off and on again. According to the maufacturer, the NAT tables are filling up but not clearing quickly enough. To fix this issue, they have released a few firmware updates but none have worked.
If I could write a script to reboot the router for me, I could then add it to cron.weekly and I wouldn't have to worry about router lockups any longer.
I found this on another site but this doesn't seem to work under mandrake 10.1:
(sleep 3; echo username; sleep 3; echo password; sleep 5; echo "ls -l"; sleep 3; echo "exit") | telnet IP Address
Anyone able to help out?
|