LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-02-2005, 08:07 PM   #1
Kaj
LQ Newbie
 
Registered: May 2001
Location: Tokyo, Japan
Distribution: Fedora, Gentoo
Posts: 19

Rep: Reputation: 0
Question 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!
 
Old 01-02-2005, 08:52 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
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.
 
Old 01-02-2005, 11:44 PM   #3
randyding
Member
 
Registered: May 2004
Posts: 552

Rep: Reputation: 31
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
telnet commands vwal_13 Linux - General 5 04-14-2004 08:03 AM
Running Scripts/Commands on Startup drknow Linux - Newbie 4 01-09-2004 05:14 AM
Linux commands in shell scripts james_cwy Linux - Newbie 4 11-10-2003 01:14 AM
Running ftp commands in scripts john lee Linux - Newbie 4 05-07-2003 12:19 AM
Scripts won't run commands Xyphoid Linux - General 4 08-08-2002 08:49 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration