Re: Testing whether the VPN is running?

2016-02-25 Thread Dan Stromberg
On Thu, Feb 18, 2016 at 1:45 AM, Ervin Hegedüs wrote: > Hi Adam, > > On Thu, Feb 18, 2016 at 09:26:58AM +, Adam Funk wrote: >> I'd like to test (inside a python 3 program) whether the VPN is >> running or not. The only thing I can think of so far is to use >> subprocess to

Re: Testing whether the VPN is running?

2016-02-25 Thread Adam Funk
On 2016-02-23, Cameron Simpson wrote: > On 18Feb2016 10:03, Adam Funk wrote: >>On 2016-02-18, Ervin Hegedüs wrote: >>> I think that the psutil modul could be better for you for this >>> task: >>> https://pypi.python.org/pypi/psutil/ >>> >>> and see the "Network" section. >>

Re: Testing whether the VPN is running?

2016-02-23 Thread Gisle Vanem
Cameron Simpson: > You might also want to check that the interface is up. > > My personal hack (not for a VPN, but for "being online", which turns my ssh > tunnels on and off) is to look in the output > of "netstat -rn" for a default route. This may imply that an alternative test > for you is

Re: Testing whether the VPN is running?

2016-02-23 Thread Cameron Simpson
On 18Feb2016 10:03, Adam Funk wrote: On 2016-02-18, Ervin Hegedüs wrote: I think that the psutil modul could be better for you for this task: https://pypi.python.org/pypi/psutil/ and see the "Network" section. if 'tun0' in psutil.net_if_addrs(): # vpn is running

Re: Testing whether the VPN is running?

2016-02-18 Thread Adam Funk
On 2016-02-18, Ervin Hegedüs wrote: > Hi Adam, > > On Thu, Feb 18, 2016 at 09:26:58AM +, Adam Funk wrote: >> I'd like to test (inside a python 3 program) whether the VPN is >> running or not. The only thing I can think of so far is to use >> subprocess to run the 'ifconfig' command, then

Re: Testing whether the VPN is running?

2016-02-18 Thread Ervin Hegedüs
Hi Adam, On Thu, Feb 18, 2016 at 09:26:58AM +, Adam Funk wrote: > I'd like to test (inside a python 3 program) whether the VPN is > running or not. The only thing I can think of so far is to use > subprocess to run the 'ifconfig' command, then check its output for > 'tun0'. Is there a

Testing whether the VPN is running?

2016-02-18 Thread Adam Funk
I'd like to test (inside a python 3 program) whether the VPN is running or not. The only thing I can think of so far is to use subprocess to run the 'ifconfig' command, then check its output for 'tun0'. Is there a better way? Thanks. -- Nam Sibbyllam quidem Cumis ego ipse oculis meis vidi in