| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-SWARE-Spam-Status: | No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS |
| X-Spam-Check-By: | sourceware.org |
| 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 17:58:10 -0500 |
| Subject: | RE: Issues with terminal freezing after scp in expect script. |
| Message-ID: | <EDF49EC9787F914CA157FF6927D65A883028392210@CBMCC-X7-MBX10.ad.cibc.com> |
| MIME-Version: | 1.0 |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
Okay the issue was with expect. The weird thing is I tried break before and=
it froze so I assumed it was not the issue. After restarting the terminal =
break worked:
"Are you sure you want to continue connecting (yes/no)?" {exp_s=
end "yes\r"}
"*assword:" { send "$unixpass\r"; }
Needs to be:
"Are you sure you want to continue connecting (yes/no)?" {exp_s=
end "yes\r"}
"*assword:" { send "$unixpass\r"; break }
If hung on password so I had to restart my terminal. Weird.
David
-----Original Message-----
From: Damo, David=20
Sent: Wednesday, January 20, 2010 3:04 PM
To: 'cygwin AT cygwin DOT com'
Subject: Issues with terminal freezing after scp in expect script.
Hi,
=20
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 pr=
ompt. After I do ctrl C it continues to process. I tried to do a ctrl c/bre=
ak/exit in the expect script, but it does not work. Any ideas what could be=
causing the problem? Scripts are below:
=20
Bash script:
=20
#!/usr/bin/bash
=20
echo `date` " - Starting shell script."
=20
touch /apps/sjsws/sunws-automation/https-autodemo.cibcwm.com/docs/runshell
=20
echo `date` " - Copy files."
=20
expect /apps/sjsws/sunws-automation/https-autodemo.cibcwm.com/docs/SMWeblog=
ic/SMWeblogiccp.exp $1 $2 $5 $6
=20
file=3D`basename $1`
=20
echo `date` " - Run build on: " $file
# expect /apps/sjsws/sunws-automation/https-autodemo.cibcwm.com/docs/SMWebl=
ogic/SMWeblogicrun.exp $1 $2 $5 $6 $3 $4
=20
echo `date` " - Finished."
=20
=20
Expect script:
=20
#!/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]
=20
set force_conservative 0 ;# set to 1 to force conservative mode even if
;# script wasn't run conservatively o=
riginally
if {$force_conservative} {
set send_slow {1 .1}
proc send {ignore arg} {
sleep .1
exp_send -s -- $arg
}
}
=20
=20
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_s=
end "yes\r"}
"*assword:" { send "$unixpass\r"; }
}
}
exp_send -- "=20
---------------------------------------------------------------------------=
-----
"
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_s=
end "yes\r"}
"*assword:" { send "$unixpass\r"; }
}
}
sleep 30
send -- "exit\r"
expect eof
=20
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |