Disconnect VPN connection when running in background?

Kevin Cernekee cernekee at gmail.com
Sun May 17 19:26:18 PDT 2015


On Sun, May 17, 2015 at 7:00 PM, Stuart Luppescu <slu at ccsr.uchicago.edu> wrote:
> On Sun, 2015-05-17 at 16:53 -0500, Joseph T Bradley wrote:
>> Is there a disconnect option, that I can use to disconnect
>> openconnect, after I've started it in background mode? I am on Linux
>> Mint 17.1, if it matters. Thanks.
>
> I call a little script like this:
> #!/bin/bash
> kill `ps aux|grep openconnect|grep -v grep|cut -c 10-15`
>
> Don't know if this is the recommended procedure but it works for me.

If there is only one openconnect instance running, you can also use
killall or pkill.  The supported signals are listed in the man page.
Usually you'll want to use SIGINT for a clean disconnection.

If you're running multiple instances, it's probably easiest to use
something like "--pid-file /var/run/openconnect.foo" so you can easily
determine the PID for each connection.



More information about the openconnect-devel mailing list