This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Issues with terminal freezing after scp in expect script.
- From: "Damo, David" <David dot Damo at CIBC dot com>
- To: "cygwin at cygwin dot com" <cygwin at cygwin dot com>
- Date: Wed, 20 Jan 2010 15:04:12 -0500
- Subject: Issues with terminal freezing after scp in expect script.
Hi,
I have interesting problem. I have bash script that calls an expect script that works fine and does an scp. However after the scp the terminal freezes. It is stuck on the bash prompt, however the prompt is not the original prompt. After I do ctrl C it continues to process. I tried to do a ctrl c/break/exit in the expect script, but it does not work. Any ideas what could be causing the problem? Scripts are below:
Bash script:
#!/usr/bin/bash
echo `date` " - Starting shell script."
touch /apps/sjsws/sunws-automation/https-autodemo.cibcwm.com/docs/runshell
echo `date` " - Copy files."
expect /apps/sjsws/sunws-automation/https-autodemo.cibcwm.com/docs/SMWeblogic/SMWeblogiccp.exp $1 $2 $5 $6
file=`basename $1`
echo `date` " - Run build on: " $file
# expect /apps/sjsws/sunws-automation/https-autodemo.cibcwm.com/docs/SMWeblogic/SMWeblogicrun.exp $1 $2 $5 $6 $3 $4
echo `date` " - Finished."
Expect script:
#!/usr/local/bin/expect -f
#
set filename [lindex $argv 0]
set hostname [lindex $argv 1]
set uu [lindex $argv 2]
set unixpass [lindex $argv 3]
set force_conservative 0 ;# set to 1 to force conservative mode even if
;# script wasn't run conservatively originally
if {$force_conservative} {
set send_slow {1 .1}
proc send {ignore arg} {
sleep .1
exp_send -s -- $arg
}
}
set timeout -1
spawn $env(SHELL)
match_max 100000
send -- "scp $filename $uu@$hostname:/tmp/\r"
while {1} {
expect {
"Are you sure you want to continue connecting (yes/no)?" {exp_send "yes\r"}
"*assword:" { send "$unixpass\r"; }
}
}
exp_send -- "
--------------------------------------------------------------------------------
"
send -- "exit\r"
sleep 10
# send -- "scp /apps/sjsws/sunws-acs/https-acsdemo.cibcwm.com/docs/archives/smasa-12.zip $uu@$hostname:/tmp/\r"
while {1} {
expect {
"Are you sure you want to continue connecting (yes/no)?" {exp_send "yes\r"}
"*assword:" { send "$unixpass\r"; }
}
}
sleep 30
send -- "exit\r"
expect eof
Thanks,
David J
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple