cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
141
Views
0
Helpful
1
Replies
Highlighted

Expect script problems

I am new to expect and I was using logic to automate disconnecting telnet session where the user is logged in and leave other lines as it is:

for {set i 0} {$i ==4} {incr i} {  
send "clear line vty $i\r"  
"confirm]" {send "\r"}  
"% Not allowed" {send "quit\r"; exit}  
}

it disconnects all the lines

now I use the "show user" command but it's hard for me to write a script around it, the output is not friendly enough for me.so I wrote IF statements in this for loop but it was not good and not even deserving to include here. please can somebody guide me in order to how to match strings in an output result and on the basis of the strings decide to clear line or not

1 REPLY 1
Highlighted
VIP Expert

There is 2 option you can do.

 

You can configure VTY Lines to discussonect automatically if they are idle 5min, so you do not required this script

line vty 0 4
exec-timeout 5 0

 

Other option is you need to store the output of VTY lines and disconnect  only meet the requirement, Line by Line, more Lines of code required.

 

example :

 

2 vty 1 cisco idle 5w1d 192.168.11.4
* 3 vty 2 cisco idle 00:00:18 192.168.11.14
5 vty 4 cisco idle 00:00:09 192.168.11.15



BB


*** Rate All Helpful Responses ***

Content for Community-Ad

This widget could not be displayed.