bash - How to use a linux expect script to reconnect to forticlientvpn -


i have code connects network external vpn, connection lost. need code detect error , try connect again.

set force_conservative 0 if {$force_conservative} {     set send_slow {1 .1}     proc send {ignore arg} {             sleep .1             exp_send -s -- $arg     } } set timeout -1 spawn $env(shell) match_max 100000 proc tryconnection {} { send -- "./forticlientsslvpn_cli --server server:port --vpnuser user"  expect -exact "./forticlientsslvpn_cli --server server:port --vpnuser user"         send -- "\r"         expect -exact "\r\npassword vpn:"         send -- "password\r"         expect -exact "\r\nstatus::setting tunnel\r\nstatus::connecting...\r"         send -- "y\r"         expect -exact "\r\nsslvpn down unexpectedly error:6\r" {                 puts "send ctrl+c"                 send \003                 tryconnection         }         expect eof } tryconnection 

i remove -exact option:

expect "*sslvpn down unexpectedly error:6*" { ... 

try running expect -d see why pattern not matching when lose connection.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -