how to run an --up script using network-manager-openvpn?
Solution 1:
Add your script to /etc/network/if-up.d/
directory.
All the scripts in this directory will run when a connection or vpn connection starts (up|vpn-up).
As noted here network-manager-openvpn does not provide such functionality, you otherwise have to use openvpn directly.
Because this directory load scripts on connection and vpn connection, your script may require additional checks.
Take a look at the file /etc/NetworkManager/dispatcher.d/01ifupdown
. You can see the which directories are used when connection changes.
I use the /etc/network/if-post-down.d/
directory with a script to disconnect in the event my vpn connection fails.
Hope this helps, cheers.