LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-15-2009, 02:04 PM   #1
saileshg9379
LQ Newbie
 
Registered: Apr 2009
Posts: 2

Rep: Reputation: 0
Problem with expect utility


Hi Friends,

I prepared a script which does a mget from SFTP using expect utility. it is working perfectly fine when i am manually running it. but when i call this script from Cron tab expect utility is not working fine. When i browsed couple of forums i came to know that Cron tab with batch command is not working fine. so as a alternative i tried to mget a file with in the expect script rather than doing a batch .

Please find the code as below

#!/usr/bin/expect
set timeout 10
spawn sftp xyz
expect -exact "Password:"
send "password
"
expect "sftp>"
send "mget ZAP-DB_DumpPre.csv
"
expect "sftp>"
send "exit
"
expect eof

Size of file is around 35 mb .
when i execute this script this is getting exited with out complete transfer.
It says some thing as below:

Fetching /folder/ZAP-DB_DumpPre.csv to ZAP-DB Dump 04-14-2009 Pre.csv
/ziprealty/folder/ZAP-DB_DumpPre.csv 12% 2976KB 276.2KB/s 01:13 ETAexit
/ziprealty/folder/ZAP-DB_DumpPre.csv 25% 5856KB 303.8KB/s 00:56 ETA/

and gets exited.

My project go Stuck just because of this issue.
Any hep would be greatly appreciated.

Thanking you
sai
 
Old 04-15-2009, 02:19 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
you've a timeout of 10 seconds yet the ETA there is over a minute, so it looks like it's giving up waiting. increase the timeout to something significantly large like 300 seconds.

TBH, expect probably isn't the best idea here. Why not just do an scp using preshared keys for passwordless authentication? That would just be one single line as a cron job.
 
Old 04-15-2009, 02:40 PM   #3
saileshg9379
LQ Newbie
 
Registered: Apr 2009
Posts: 2

Original Poster
Rep: Reputation: 0
HI Chris,

Thank you very much for your quick replay. Yes it works fine now. Since two parties had accepted that it will be done with sftp and also it had been a long time that we were working on it at this point of moment i cannot change it.

Thanking you,
Sailesh
 
Old 04-15-2009, 02:50 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
departmental managers... huh!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Problem in Expect Script Accrio Linux - General 2 10-15-2008 10:33 PM
expect problem john83reuben Programming 5 07-30-2008 07:35 AM
problem in expect john83reuben Programming 1 07-16-2008 07:00 AM
Expect Utility and Telnet metallica1973 Programming 1 12-28-2007 02:58 PM
Expect Utility newbie Queenie245 Programming 2 10-12-2007 11:07 AM


All times are GMT -5. The time now is 04:16 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration