LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 06-23-2004, 05:40 PM   #1
rajatgarg
Member
 
Registered: Oct 2003
Posts: 41

Rep: Reputation: 15
automae telnet and mail check using pine


Hi Guys,
I am using expect and send to write a script to automate telnet and executig pine.
Problem is that as soon as I execute pine, script exits and kills the child process and makes pine unaccessible.

I am trying to write a script that can remotely login to server, execute pine and I can use pine till the end of day (without exiting). I dont want to downlaod the mail from server or run the script again at again.

here is the sample script that works until loggin in remote machine :

#!/usr/bin/expect -f

set prompt "(%|#|\\$|>)"
set timeout 10

spawn telnet abcd.com
expect "login: "
send "rajat\n"
expect "Passowrd: "
send "abcd123\n"
expect "{rajat}1:"
send "pine "

---> something has to be done in last line or something has to be added.


Pls help !!! or tell me some alternate method.


Thanks,
Rajat Garg
 
Old 06-24-2004, 12:53 PM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Alternate method by using Net::Telnet perl module :
Code:
#!/usr/bin/perl -w

use Net::Telnet ();

$connection = new Net::Telnet;
$connection->open("abcd.com");

$connection->waitfor('/login.*$/');
$connection->print("rajat");

$connection->waitfor('/Password.*$/');
$connection->print("abcd123");

$connection->waitfor('/\{rajat\}1.*$/');
$connection->print("pine");

Last edited by keefaz; 06-24-2004 at 12:54 PM.
 
Old 06-25-2004, 12:25 AM   #3
arvind_sv
Member
 
Registered: Oct 2002
Location: Bangalore
Distribution: Gentoo Linux
Posts: 96

Rep: Reputation: 16
Hi rajatgarg,

I think the line you're looking for is "interact". Put that in the last line:

.
.
.
send "pine\n"
interact

Arvind

Last edited by arvind_sv; 06-25-2004 at 12:34 AM.
 
  


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
Pine 4.58 can't send mail cseanburns Linux - Software 10 12-24-2004 01:34 PM
Question about Pine and POP3 Mail jpbarto Linux - Software 0 08-25-2004 08:26 AM
Automae telnet log in and execute commands (expect and send) rajatgarg Linux - Networking 0 06-24-2004 11:37 AM
pine: moving mail to another mailbox dARkHunTEr Linux - Software 0 05-08-2004 06:31 AM
PINE can't send mail dushkinup Linux - Software 0 04-09-2004 04:34 PM

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

All times are GMT -5. The time now is 08:57 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