Quantcast
Channel: Active questions tagged expect - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 157

How use 'expect' to run 'openconnect VPN' in background?

$
0
0

I'm a newbie to write bash script,I was using macOS catalina, and

I write a bash script which use expect to run openconnect,

#!/usr/bin/expect...spawn sudo openconnect --user xxx --protocol=anyconnect...send xxxinteract

this works perfectly,but I want to run it in background, when I add '-b'(or --background parameter),

#!/usr/bin/expect...spawn sudo openconnect --user xxx --protocol=anyconnect -b...send xxxinteract

the output shows the pid is running in background, but the pid is not exit actually, and the connect isn't successful,

Is there anything I'm missing or I did incorrect?

EDIT: If I do not use this script, just using openconnect -b directly in terminal,it works, but I want to use expect so I can connect use script to connect automatically


Viewing all articles
Browse latest Browse all 157

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>