Testing whether the VPN is running?

Ervin Hegedüs airween at gmail.com
Thu Feb 18 04:45:31 EST 2016


Hi Adam,

On Thu, Feb 18, 2016 at 09:26:58AM +0000, 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 better way?

you didn't wrote, which system (OS) you want to use - based on
the "ifconfig" and "tun0" keywords, possible that's a Linux.

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.


Regards,


a.
 
-- 
I � UTF-8



More information about the Python-list mailing list