Re: scp failing
- From: hendedav@xxxxxxxxx
- Date: Thu, 7 May 2009 14:34:33 -0700 (PDT)
On Apr 8, 12:39 pm, hende...@xxxxxxxxx wrote:
On Apr 8, 11:57 am, Bruce Hartweg <Bruce-DoNot...@xxxxxxxxxxx> wrote:
hende...@xxxxxxxxx wrote:
On Apr 8, 10:48 am, Glenn Jackman <gle...@xxxxxx> wrote:
At 2009-04-07 03:26PM, "hende...@xxxxxxxxx" wrote:
Gang,When you run scp from the command line, how long does it take?
I am trying to use scp with anexpectscript but for some reason
scp will start to copy for a second or two, then just stops (showing
the "failed 1" send_user text). If I run scp from the command line,
all works just fine. I tried searching Google groups and didn't find
anything that helps. Below is theexpectscript. Let me know any
other information you may require. Using Kubuntu 8.10.
The "failed 1" branch occurs at a timeout. What's the value of the
timeout variable there? Try setting it to a higher value:
set timeout 30 ;# or another value (in seconds) as appropriate
[...]> expect{
[...]
timeout {[...]
if {$verbose eq "1"} { send_user "\[failed 1\]\n" }
return 0
}
--
Glenn Jackman
Write a wise saying and your name will live forever. -- Anonymous
the scp command takes some time to complete (like 10-15 minutes).
Basically I don't need this to time out, but to complete. I tried
commenting out the "timeout" and "eof" section and it still didn't
complete. Why wouldn't the script just wait until the scp finishes?
why would it?
it waits on what you tell it to wait on.
taking out the timeout block does *not* remove
the timeout, it just removes your handler when
the timeout occurs, if you don;t want a timeout
set it to -1 and keep your eof handler, or
within your timeout handler, instead of erroring
out, just do exp_continue to keep waiting, this
will give a you a place where you could do some
checks (for user cancel, etc) to bail if you want
to or keep waiting for completion.
Bruce
Thanks for the info guys. I am not able to do any adjustments with it
right now, but I will later tonight and let you know what I find.
Thanks,
Dave
Sorry it took so long to get back with you guys. Using this same
script and the suggested fixes, I am still having problems. Basically
this script is running another script on a remote computer. It looks
like the remote script is getting run but sometimes it completes and
when it doesn't it's always in a random spot. This would tell me that
perhaps the timeout is still occuring and the load on the other
computer at the time the remote script is run is what is giving it the
appearance of the it stopping randomly. When this script is run on
the remote computer, is completes every time but some times it takes
longer than others due to the afore mentioned load. I will give the
section of the script below. I would greatly appreciate any further
help.
Dave
set retval [useSSH $prompt $verbose $host $port $username $password]
set spawn_id $retval;
if {$verbose eq "1"} { send_user " Checking if reassemble.sh
exists: " }
send "ls reassemble.sh\r";
expect {
-re "o such file or directory" {
if {$verbose eq "1"} { send_user "\[creating\] " }
*truncated for space, but this section actually creates the script
remotely if it doesn't exist*
expect -re "$prompt" { }
}
-re "$prompt" {
if {$verbose eq "1"} { send_user "\[exists\] " }
}
}
if {$verbose eq "1"} { send_user "\[done\]\n" }
if {$verbose eq "1"} { send_user " Running the reassemble.sh
script: " }
send "./reassemble.sh \"$destination\" \"$value
\"\r"; # execute the script
expect {
-re "o such file or directory" {
if {$verbose eq "1"} { send_user "\[failed\]\n" }
send "logout\r"
exit 1
}
-re
"FAILED" { # the md5
checksum failed
if {$verbose eq "1"} { send_user "\[failed\]\n" }
send "logout\r"
exit 1
}
timeout {
send_user "resetting time"
exp_continue
}
-re "$prompt" {
if {$verbose eq "1"} { send_user "\[success\]\n" }
send "logout\r"
}
}
I know the useSSH function call is working because I can see the
progress on the remote computer every time its called. I also, don't
ever see the "resetting time" string, so I am wondering what is going
on with the timeout? Thanks again for any help.
Dave
.
- Follow-Ups:
- Re: scp failing
- From: hendedav
- Re: scp failing
- Prev by Date: Re: Expect + grep
- Next by Date: Re: gnuplot weirdness -- works from shell, not from Tcl script -- please help!
- Previous by thread: Special Track “Computational Bioimaging” within the ISVC09 USA - Announce & Call for Papers
- Next by thread: Re: scp failing
- Index(es):
Relevant Pages
|