When using jlogin with the '-s' option , No further output ?-{
john heasley
heas at shrubbery.net
Sat Apr 5 06:04:18 UTC 2003
Fri, Apr 04, 2003 at 12:11:02PM -0500, Mr. James W. Laferriere:
> Oops ... , JimL
>
> On Fri, 4 Apr 2003, Mr. James W. Laferriere wrote:
> > Hello Andrew & John , Attached is a gzipd tarball of the script
> > that at least gets output to a file . Thank you . JimL
> > ps: When I get it debugge & claned up I'll ask that the team look at
> > placing it into the utils/ area .
>
> > On Thu, 3 Apr 2003, Andrew Partan wrote:
> > > On Thu, Apr 03, 2003 at 03:06:54PM -0500, Mr. James W. Laferriere wrote:
> > > > Now that I can at last can get output ot appear someplace do
> > > > you have any thoughts on getting output to stdout ?
> > > Can you send the script? I can give it a shot on one of my junipers
> > > & see if I spot anything.
> > > --asp
--- jlogin-s-interact-with-sub-sessions.exp.old Sat Apr 5 05:14:26 2003
+++ jlogin-s-interact-with-sub-sessions.exp Sat Apr 5 06:01:08 2003
@@ -98,7 +98,7 @@
}
# try sending all output to a file
-log_file -a -noappend $Elog_file
+log_file -a $Elog_file
# set exp_internal 0
# set log_user 0
@@ -135,7 +135,7 @@
set rTcmd_file [open $Tcmd_file r]
# get the line_count in file $Tcmd_file
- catch {exec count_lines.sh $Tcmd_file} line_count
+ catch {exec wc -l $Tcmd_file | sed -e "s/^ *//" | cut -f1 "-d "} line_count
# To jump thru hoops for first line in $rTcmd_file
set cmd_num 1
@@ -146,20 +146,19 @@
# Debugging
#send_error "cmd_num=\"$cmd_num\" , line_count=\"$line_count\"\n"
- if { $cmd_num > 1 && $cmd_num <= $line_count } {
+ send "$line\r"
+ sleep 0.07
+
+ if { $cmd_num > 0 && $cmd_num < $line_count } {
# Debugging
#send_error "Here Tprmpt , cmd_num=$cmd_num sending: $line\n\n"
expect -re $Tprmpt {
- sleep 0.07
- send "$line\r"
}
} else {
# Debugging
#send_error "Here prompt , cmd_num=$cmd_num sending: $line\n\n"
# This will only happen once . (I hope)
expect -re $prompt {
- sleep 0.07
- send "$line\r"
}
}
incr cmd_num 1
@@ -181,7 +180,6 @@
# Check that we either timeout or have gotten the prompt thru jlogin
send "show system users\r"
-send "\r"
expect {
timeout {
@@ -190,8 +188,9 @@
#send_error "$prompt, timeout\n"
send_error "Error: did not receive prompt\n"
- exit
+ return 1
}
+ -re "\[\r\n\]+" { exp_continue; }
-re "^.*$prompt" {
# Debugging
@@ -206,15 +205,15 @@
#send_error "Here #4\n"
# send 'quit' to the router
-send "quit\r"
-expect {
- timeout {
- send_error "Error: timeout waiting for EOF after quit\n" ;
- }
- eof {
- exit 0 ;
- }
-}
+#send "quit\r"
+#expect {
+# timeout {
+# send_error "Error: timeout waiting for EOF after quit\n" ;
+# }
+# eof {
+# exit 0 ;
+# }
+#}
# Debugging
#send_error "Here #EOF\n" ;
More information about the Rancid-discuss
mailing list