Junos Automation (Scripting)
Reply
Visitor
dsulli99
Posts: 9
Registered: ‎10-17-2010
0

Lame Question Regarding SLAX

Hi, All, 

 

I posted a similar post in another forum so I apologize if you're reading this twice.  Basically I have a lame SLAX question that I'm sure is pretty easy to answer.  I'm trying to create a custom login script that sets my terminal emulation type and screen length "set cli screen-length 0" and "run set cli terminal vt100" variables.  Basically I've got the following script;

 

version 1.0;
import "../import/junos.xsl";
match / {
        <op-script-results> {
                <output> "Starting Login Script!";
                var $set_vt100 = {
                        <command> 'set cli terminal vt100';
                }
                var $result = jcs:invoke($set_vt100);
                <output> "Ending Login Script!";
        }
}
The script is actually executing fine, but the problem is that it appears to be spawning a separate user login process to execute this command and then quitting.  The settings aren't actually applying for the current login.  Is there any way around this?  I would like to set my CLI options for my terminal upon login. 
Nov  3 01:32:02 10.4.224.20 file[95653]: UI_LOGIN_EVENT: User 'slax-test' login, class 'j-uoc_custom' [95653], ssh-connection '128.135.2.160 54385 10.4.224.20 22', client-mode 'junoscript'
Nov  3 01:32:02 10.4.224.20 file[95653]: UI_CMDLINE_READ_LINE: User 'slax-test', command 'rpc command set cli terminal vt100 '
Nov  3 01:32:02 10.4.224.20 file[95653]: UI_JUNOSCRIPT_CMD: User 'slax-test' used JUNOScript client to run command 'set cli terminal type=vt100'
Nov  3 01:32:02 10.4.224.20 file[95653]: UI_LOGOUT_EVENT: User 'slax-test' logout
Thank-you,
Dan Sullivan

 

Recognized Expert
ccall
Posts: 230
Registered: ‎06-18-2008
0

Re: Lame Question Regarding SLAX

I replied in the other forum, but I'll do so here too. It isn't possible for a script (login or normal op script) to modify your current session settings.

Visitor
dsulli99
Posts: 9
Registered: ‎10-17-2010
0

Re: Lame Question Regarding SLAX

ccali,

 

Thank you for your reply.  Do you (or anybody) know if it's possible to set these types of options upon login or link them to a user class in any way (script or no script)?  I would think that this would be something that many users would like to do.

 

Dan

Recognized Expert
ccall
Posts: 230
Registered: ‎06-18-2008
0

Re: Lame Question Regarding SLAX

It doesn't look like there is a way to do this currently within Junos, unfortunately.

Visitor
dsulli99
Posts: 9
Registered: ‎10-17-2010
0

Re: Lame Question Regarding SLAX

Ok, thanks for your help.

 

Dan Sullivan

Contributor
Cougar
Posts: 12
Registered: ‎11-14-2008
0

Re: Lame Question Regarding SLAX

It is not possible to set screen-length to 0 but it is possible to set max size. Something like this:

 

> stty rows 100000
> export TERM=test
> ssh 192.0.2.1
...
cougar@example> show cli 
...
CLI screen-length set to 34464
CLI screen-width set to 80
CLI terminal is 'test'
--
Cougar
Copyright© 1999-2013 Juniper Networks, Inc. All rights reserved.