LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-12-2010, 09:55 AM   #1
nass
Member
 
Registered: Apr 2006
Location: Athens, Greece
Distribution: slackware, debian, ubuntu
Posts: 666

Rep: Reputation: 39
scripting with telnet sessions


hello everyone,
hypothetically speaking, can i write a script in which a telnet session is opened and then some more commands are forwarded to that session?
 
Old 04-12-2010, 11:43 AM   #2
Crashbox
Member
 
Registered: Jun 2004
Location: USA
Distribution: Slackware
Posts: 137

Rep: Reputation: 22
telnetrc

You can cause commands to be run every time a telnet session is started by placing the desired commands in the local telnetrc file ($HOME/.telnetrc). Check the man page for telnetrc for details.
 
Old 04-12-2010, 12:33 PM   #3
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
Another way of doing it is to use 'expect'.
 
Old 04-12-2010, 01:01 PM   #4
nass
Member
 
Registered: Apr 2006
Location: Athens, Greece
Distribution: slackware, debian, ubuntu
Posts: 666

Original Poster
Rep: Reputation: 39
Nice!
thank you both!
 
Old 04-12-2010, 02:52 PM   #5
jovanoti
LQ Newbie
 
Registered: Mar 2010
Distribution: Slackware
Posts: 25

Rep: Reputation: 2
A year ago I had to automate connection to SMTP server. I used telnet and a little bash magic.

Code:
( echo open localhost 25}

echo "ehlo example.org"
echo "mail from: test1@example.org"
echo "rcpt to: test2@example.org"
echo "data"
echo "Subject: Test Message"
echo ""
echo "."
echo "quit"

echo exit ) | telnet
You can put `sleep <seconds>' between echo statements to delay execution.
 
  


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
Max Telnet Sessions w3bd3vil Solaris / OpenSolaris 2 01-08-2009 02:11 PM
scripting telnet sessions, redirect issue farkus888 Solaris / OpenSolaris 4 03-03-2007 02:18 PM
No. of telnet sessions zatka Linux - Networking 2 01-16-2005 02:36 AM
Monitoring telnet sessions luciji Linux - Networking 6 05-22-2003 08:16 PM
telnet sessions acid_kewpie Linux - Newbie 7 07-17-2001 02:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:57 AM.

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