Mailing List Archive

When using jlogin with the '-s' option , No further output ?-{
Hello All , Every time I use the '-s' option to jlogin the output
is lost . Or at least I am unable to find to which fiel
descriptor it is (re-)directed . All help appreciated . JimL
--
+------------------------------------------------------------------+
| James W. Laferriere | System Techniques | Give me VMS |
| Network Engineer | P.O. Box 854 | Give me Linux |
| babydr at baby-dragons.com | Coudersport PA 16915 | only on AXP |
+------------------------------------------------------------------+
When using jlogin with the '-s' option , No further output ?-{ [ In reply to ]
Wed, Apr 02, 2003 at 10:29:49AM -0500, Mr. James W. Laferriere:
> Hello All , Every time I use the '-s' option to jlogin the output
> is lost . Or at least I am unable to find to which fiel
> descriptor it is (re-)directed . All help appreciated . JimL

there is no redirection, unless you do so explicitly. output will
appear on stdout (1) and stderr (2), if you tell expect to do so:

log_user 1
When using jlogin with the '-s' option , No further output ?-{ [ In reply to ]
Hello John , The '-s' option in jlogin sets log_user to 1 by
default . And I have in my -s scripts set it to 1 as well .
Still no output from the router .

I have tried 'log_file -a -noappend junk.txt' & it is empty as
well . I do not even get the 'send_user' output I have setup to
give me (sort of) debug output . I just tried send_error & is
swallows that output too !-{

Where else can I look ? Tia , JimL

On Wed, 2 Apr 2003, john heasley wrote:
> Wed, Apr 02, 2003 at 10:29:49AM -0500, Mr. James W. Laferriere:
> > Hello All , Every time I use the '-s' option to jlogin the output
> > is lost . Or at least I am unable to find to which fiel
> > descriptor it is (re-)directed . All help appreciated . JimL
> there is no redirection, unless you do so explicitly. output will
> appear on stdout (1) and stderr (2), if you tell expect to do so:
> log_user 1
--
+------------------------------------------------------------------+
| James W. Laferriere | System Techniques | Give me VMS |
| Network Engineer | P.O. Box 854 | Give me Linux |
| babydr at baby-dragons.com | Coudersport PA 16915 | only on AXP |
+------------------------------------------------------------------+
When using jlogin with the '-s' option , No further output ?-{ [ In reply to ]
Wed, Apr 02, 2003 at 12:01:34PM -0500, Mr. James W. Laferriere:
> Hello John , The '-s' option in jlogin sets log_user to 1 by

no, it sets it to 0 when a script is specified.

174 if { $do_script } {
175 log_user 0
176 } else {
177 log_user 1
178 }

> default . And I have in my -s scripts set it to 1 as well .
> Still no output from the router .
>
> I have tried 'log_file -a -noappend junk.txt' & it is empty as
> well . I do not even get the 'send_user' output I have setup to
> give me (sort of) debug output . I just tried send_error & is
> swallows that output too !-{
>
> Where else can I look ? Tia , JimL

then i suspect either an error in how you are running jlogin from your
shell, a typo in the script, or your expect binary is buggered. really
can not say without seeing the code.

also, see the examples in util/*.exp.

> On Wed, 2 Apr 2003, john heasley wrote:
> > Wed, Apr 02, 2003 at 10:29:49AM -0500, Mr. James W. Laferriere:
> > > Hello All , Every time I use the '-s' option to jlogin the output
> > > is lost . Or at least I am unable to find to which fiel
> > > descriptor it is (re-)directed . All help appreciated . JimL
> > there is no redirection, unless you do so explicitly. output will
> > appear on stdout (1) and stderr (2), if you tell expect to do so:
> > log_user 1
> --
> +------------------------------------------------------------------+
> | James W. Laferriere | System Techniques | Give me VMS |
> | Network Engineer | P.O. Box 854 | Give me Linux |
> | babydr at baby-dragons.com | Coudersport PA 16915 | only on AXP |
> +------------------------------------------------------------------+
When using jlogin with the '-s' option , No further output ?-{ [ In reply to ]
Hello John , Hmm, This looks like a one person show , at least
on this maillist . Inline .

On Wed, 2 Apr 2003, john heasley wrote:

> Wed, Apr 02, 2003 at 12:01:34PM -0500, Mr. James W. Laferriere:
> > Hello John , The '-s' option in jlogin sets log_user to 1 by
> no, it sets it to 0 when a script is specified.
> 174 if { $do_script } {
> 175 log_user 0
> 176 } else {
> 177 log_user 1
> 178 }
Here's a good one on me . If I use the -s option & do_script is
set to 0 the script specified in the -s option is not processed .
If set to 1 it does get processed . And the using the log_file
(ie: log_file -a -noappend junk.txt) I am able to get the output
from my sub script . But otherwise nothing gets sent to stdout .
The note above the do_script seems to say that the underlying
script is responsible for sending output , But instead of having
anything to do with output it is input that gets shanghi'd .
Now that I can at last can get output ot appear someplace do
you have any thoughts on getting output to stdout ?

> > default . And I have in my -s scripts set it to 1 as well .
> > Still no output from the router .
> >
> > I have tried 'log_file -a -noappend junk.txt' & it is empty as
> > well . I do not even get the 'send_user' output I have setup to
> > give me (sort of) debug output . I just tried send_error & is
> > swallows that output too !-{
> >
> > Where else can I look ? Tia , JimL
> then i suspect either an error in how you are running jlogin from your
> shell, a typo in the script, or your expect binary is buggered. really
> can not say without seeing the code.
> also, see the examples in util/*.exp.
That is where I stole the basis for the script .

> > On Wed, 2 Apr 2003, john heasley wrote:
> > > Wed, Apr 02, 2003 at 10:29:49AM -0500, Mr. James W. Laferriere:
> > > > Hello All , Every time I use the '-s' option to jlogin the output
> > > > is lost . Or at least I am unable to find to which fiel
> > > > descriptor it is (re-)directed . All help appreciated . JimL
> > > there is no redirection, unless you do so explicitly. output will
> > > appear on stdout (1) and stderr (2), if you tell expect to do so:
> > > log_user 1
--
+------------------------------------------------------------------+
| James W. Laferriere | System Techniques | Give me VMS |
| Network Engineer | P.O. Box 854 | Give me Linux |
| babydr at baby-dragons.com | Coudersport PA 16915 | only on AXP |
+------------------------------------------------------------------+
When using jlogin with the '-s' option , No further output ?-{ [ In reply to ]
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
When using jlogin with the '-s' option , No further output ?-{ [ In reply to ]
Thu, Apr 03, 2003 at 03:06:54PM -0500, Mr. James W. Laferriere:
> Hello John , Hmm, This looks like a one person show , at least
> on this maillist . Inline .

there are four folks.

> On Wed, 2 Apr 2003, john heasley wrote:
>
> > Wed, Apr 02, 2003 at 12:01:34PM -0500, Mr. James W. Laferriere:
> > > Hello John , The '-s' option in jlogin sets log_user to 1 by
> > no, it sets it to 0 when a script is specified.
> > 174 if { $do_script } {
> > 175 log_user 0
> > 176 } else {
> > 177 log_user 1
> > 178 }
> Here's a good one on me . If I use the -s option & do_script is
> set to 0 the script specified in the -s option is not processed .
> If set to 1 it does get processed . And the using the log_file
> (ie: log_file -a -noappend junk.txt) I am able to get the output
> from my sub script . But otherwise nothing gets sent to stdout .
> The note above the do_script seems to say that the underlying
> script is responsible for sending output , But instead of having
> anything to do with output it is input that gets shanghi'd .
> Now that I can at last can get output ot appear someplace do
> you have any thoughts on getting output to stdout ?
>
> > > default . And I have in my -s scripts set it to 1 as well .
> > > Still no output from the router .
> > >
> > > I have tried 'log_file -a -noappend junk.txt' & it is empty as
> > > well . I do not even get the 'send_user' output I have setup to
> > > give me (sort of) debug output . I just tried send_error & is
> > > swallows that output too !-{
> > >
> > > Where else can I look ? Tia , JimL
> > then i suspect either an error in how you are running jlogin from your
> > shell, a typo in the script, or your expect binary is buggered. really
> > can not say without seeing the code.
> > also, see the examples in util/*.exp.
> That is where I stole the basis for the script .

The example scripts work for me. all i can suggest is what andrew already
has, send the code. you can send it to rancid at shrubbery.net if you do not
wish it to appear on the list.

>
> > > On Wed, 2 Apr 2003, john heasley wrote:
> > > > Wed, Apr 02, 2003 at 10:29:49AM -0500, Mr. James W. Laferriere:
> > > > > Hello All , Every time I use the '-s' option to jlogin the output
> > > > > is lost . Or at least I am unable to find to which fiel
> > > > > descriptor it is (re-)directed . All help appreciated . JimL
> > > > there is no redirection, unless you do so explicitly. output will
> > > > appear on stdout (1) and stderr (2), if you tell expect to do so:
> > > > log_user 1
> --
> +------------------------------------------------------------------+
> | James W. Laferriere | System Techniques | Give me VMS |
> | Network Engineer | P.O. Box 854 | Give me Linux |
> | babydr at baby-dragons.com | Coudersport PA 16915 | only on AXP |
> +------------------------------------------------------------------+
When using jlogin with the '-s' option , No further output ?-{ [ In reply to ]
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
--
+------------------------------------------------------------------+
| James W. Laferriere | System Techniques | Give me VMS |
| Network Engineer | P.O. Box 854 | Give me Linux |
| babydr at baby-dragons.com | Coudersport PA 16915 | only on AXP |
+------------------------------------------------------------------+
When using jlogin with the '-s' option , No further output ?-{ [ In reply to ]
On Fri, Apr 04, 2003 at 11:31:41AM -0500, 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

No attachment.
--asp
When using jlogin with the '-s' option , No further output ?-{ [ In reply to ]
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
--
+------------------------------------------------------------------+
| James W. Laferriere | System Techniques | Give me VMS |
| Network Engineer | P.O. Box 854 | Give me Linux |
| babydr at baby-dragons.com | Coudersport PA 16915 | only on AXP |
+------------------------------------------------------------------+
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jlogin-s-interact.tgz
Type: application/octet-stream
Size: 2677 bytes
Desc:
Url : http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20030404/e3a671fc/attachment.obj
When using jlogin with the '-s' option , No further output ?-{ [ In reply to ]
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" ;
When using jlogin with the '-s' option , No further output ?-{ [ In reply to ]
Hello John , Thank you for the patch . Now here is the second
part of the problem . See after my .sig .

On Fri, 4 Apr 2003, john heasley wrote:
> 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
--
+------------------------------------------------------------------+
| James W. Laferriere | System Techniques | Give me VMS |
| Network Engineer | P.O. Box 854 | Give me Linux |
| babydr at baby-dragons.com | Coudersport PA 16915 | only on AXP |
+------------------------------------------------------------------+
# make the first snapshot of the memory status outside of
# the loop , allows us to do a diff on the output ;-)

hostname
spawn ssh -c 3des -x -l user hostname

***Private Property of Adelphia Business Solutions***
* *
* UNAUTHORIZED ACCESS IS PROHIBITED *
* violators will be prosecuted *
* to the fullest extent of the law *
* *
*****************************************************
user at hostname's password:
--- JUNOS 5.4R3.2 built 2002-11-07 00:57:02 UTC

user at hostname>

user at hostname> set cli complete-on-space off
Disabling complete-on-space

user at hostname> set cli screen-length 0
Screen length set to 0

hostname

Error: TIMEOUT reached
can't read "in_proc": no such variable
while executing
"if { $in_proc} {
return 1
} else {
continue
}"
invoked from within
"expect -re $Tprmpt {
}"
(procedure "cycleTcmd_file" line 24)
invoked from within
"cycleTcmd_file $Tcmd_file $prompt $Tprmpt"
invoked from within
"expect -nobrace timeout {

# Debugging
#send_error "$prompt, timeout\n"

send_error "Error: did not receive prompt\n"
return 1
} -re {[
..."
invoked from within
"expect {
timeout {

# Debugging
#send_error "$prompt, timeout\n"

send_error "Error: did not receive prompt\n"
return 1
}
-re "\[.\r\n..."
(file "jlogin-s-interact-with-sub-sessions-v1.exp" line 170)
invoked from within
"source $sfile"
("foreach" body line 64)
invoked from within
"foreach router [lrange $argv $i end] {
set router [string tolower $router]
send_user "$router\n"

set prompt ">"

# Figure out usernam..."
(file "/usr/local/rancid/bin/jlogin" line 430)
show system users
3:28PM up 2 mins, 1 user, load averages: 0.61, 0.30, 0.12
USER TTY FROM LOGIN@ IDLE WHAT
user p0 test-net.122 3:28PM - -cli (cl

user at hostname> start shell
%
Error: TIMEOUT reached
can't read "in_proc": no such variable
while executing
"if { $in_proc} {
return 1
} else {
continue
}"
invoked from within
"expect -re $Tprmpt {
}"
(procedure "cycleTcmd_file" line 24)
invoked from within
"cycleTcmd_file $Tcmd_file $prompt $Tprmpt"
invoked from within
"expect -nobrace timeout {

# Debugging
#send_error "$prompt, timeout\n"

send_error "Error: did not receive prompt\n"
return 1
} -re {[
..."
invoked from within
"expect {
timeout {

# Debugging
#send_error "$prompt, timeout\n"

send_error "Error: did not receive prompt\n"
return 1
}
-re "\[.\r\n..."
(file "jlogin-s-interact-with-sub-sessions-v1.exp" line 170)
invoked from within
"source $sfile"
("foreach" body line 64)
invoked from within
"foreach router [lrange $argv $i end] {
set router [string tolower $router]
send_user "$router\n"

set prompt ">"

# Figure out usernam..."
(file "/usr/local/rancid/bin/jlogin" line 430)
When using jlogin with the '-s' option , No further output ?-{ [ In reply to ]
Mon, Apr 07, 2003 at 08:41:41PM -0400, Mr. James W. Laferriere:
> Hello John , Thank you for the patch . Now here is the second
> part of the problem . See after my .sig .
>
> # make the first snapshot of the memory status outside of
> # the loop , allows us to do a diff on the output ;-)
>
> hostname
> spawn ssh -c 3des -x -l user hostname
>
> ***Private Property of Adelphia Business Solutions***
> * *
> * UNAUTHORIZED ACCESS IS PROHIBITED *
> * violators will be prosecuted *
> * to the fullest extent of the law *
> * *
> *****************************************************
> user at hostname's password:
> --- JUNOS 5.4R3.2 built 2002-11-07 00:57:02 UTC
>
> user at hostname>
>
> user at hostname> set cli complete-on-space off
> Disabling complete-on-space
>
> user at hostname> set cli screen-length 0
> Screen length set to 0
>
> hostname
>
> Error: TIMEOUT reached
> can't read "in_proc": no such variable
> while executing
> "if { $in_proc} {

see expect_after() (expect(1)). you're inheriting the one from
proc login().
When using jlogin with the '-s' option , No further output ?-{ [ In reply to ]
Hello John ,

On Tue, 8 Apr 2003, john heasley wrote:
> Mon, Apr 07, 2003 at 08:41:41PM -0400, Mr. James W. Laferriere:
> > Hello John , Thank you for the patch . Now here is the second
> > part of the problem . See after my .sig .
> > ... snip
> see expect_after() (expect(1)). you're inheriting the one from
> proc login().
From the output I have the jlogin script itself is not completing
thru to login when I issue the -s option from inside a sh script .
But , from the cmd line it will complete .

Do you have a URL that describes expect_after's use ?
I have found the instance in the 'jlogin' But , We should at
least be getting logged into the router -before- I run into the
expect_after being inherited into my script . Right ?
Tia , JimL
--
+------------------------------------------------------------------+
| James W. Laferriere | System Techniques | Give me VMS |
| Network Engineer | P.O. Box 854 | Give me Linux |
| babydr at baby-dragons.com | Coudersport PA 16915 | only on AXP |
+------------------------------------------------------------------+
When using jlogin with the '-s' option , No further output ?-{ [ In reply to ]
Hello John , All , Never mind . Being blind(figuratively) has
its draw backs . The script I had created was using the incorrect
secondary prompt string . Tnx all for the help . JimL

On Wed, 9 Apr 2003, Mr. James W. Laferriere wrote:
> Hello John ,
> On Tue, 8 Apr 2003, john heasley wrote:
> > Mon, Apr 07, 2003 at 08:41:41PM -0400, Mr. James W. Laferriere:
> > > Hello John , Thank you for the patch . Now here is the second
> > > part of the problem . See after my .sig .
> > > ... snip
> > see expect_after() (expect(1)). you're inheriting the one from
> > proc login().
> From the output I have the jlogin script itself is not completing
> thru to login when I issue the -s option from inside a sh script .
> But , from the cmd line it will complete .
>
> Do you have a URL that describes expect_after's use ?
> I have found the instance in the 'jlogin' But , We should at
> least be getting logged into the router -before- I run into the
> expect_after being inherited into my script . Right ?
> Tia , JimL
>

--
+------------------------------------------------------------------+
| James W. Laferriere | System Techniques | Give me VMS |
| Network Engineer | P.O. Box 854 | Give me Linux |
| babydr at baby-dragons.com | Coudersport PA 16915 | only on AXP |
+------------------------------------------------------------------+