LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Issuing Telnet commands via bash scripts (https://www.linuxquestions.org/questions/programming-9/issuing-telnet-commands-via-bash-scripts-273110/)

Kaj 01-02-2005 08:07 PM

Issuing Telnet commands via bash scripts
 
Hi Gang,

I've done very little bash scripting in my time and was just wondering about the question posted above. Anyway here's what I would like to do...

I have a Cisco router which I need to telnet into, and perform the following commands :-

en
password
config t
rtr 1
type pathEcho protocol ipIcmpEcho 192.168.1.1
rtr schedule 1 start-time now life 120 ageout 60
end
exit

I probably need to do this every 3 minutes so I believe there should be a sleep 180 towards the end of the loop?

Any help on this would be appreciated! Thanks so much!

btmiller 01-02-2005 08:52 PM

Look into the expect package. I've never used it, but it's a system that let's you handle things like telnet connections where input is required. I'm not familiar with IOS, but is it possible to just set it up to run those commands itself? If so, that's probably easier and doesn't rely on your workstation being up.

randyding 01-02-2005 11:44 PM

There is more than one type of program out there that can do this, I'm not sure how bash by itself can do this.

I really like C-kermit for doing this kind of scripting. I don't work with routers, but with racks of embedded computers and have automated upgrading their firmware in a C-kermit script. C-kermit can automatically FTP data to the systems, then telnet in and issue the commands to update the onboard flash. This is similar to what you are trying to do.


All times are GMT -5. The time now is 07:30 AM.