Execute script after OpenVPN up with Python Venv

26 views Asked by At

I'm trying to figure out a way to run my script after OpenVPN establishes connection. I managed to run simple script by doing following thing:

sudo openvpn --config /etc/openvpn/ovpn_tcp/<server>.nordvpn.com.tcp.ovpn --auth-user-pass /etc/openvpn/auth.txt --script-security 2 --up <script>

The problem is when I want to run Python script that requires virtual environment.

What I attempted is something like this:

sudo openvpn --config /etc/openvpn/ovpn_tcp/<server>.nordvpn.com.tcp.ovpn --auth-user-pass /etc/openvpn/auth.txt --script-security 2 --up "source venv/bin/activate && <script>.sh"

But in such case openvpn prints out error

Options error: --up script fails with 'source': No such file or directory (errno=2)

Is there any way to make it runnign?

0

There are 0 answers