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
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.
>>
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
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
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
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
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