'Run OpenVPN client in background
I’m trying to start a VPN connection through a shell script but I can’t run it in background, I’ve tried with:
sudo openvpn --config "/home/user/config.ovpn" &
sudo openvpn --config "/home/user/config.ovpn" > /dev/null 2>&1
Also try through a screen but I don’t know how to indicate the sudo password to run the openvpn command.
My idea is to make it work in the background as the bash script I’m creating must run some tasks connected to a particular vpn.
Any suggestions?
Regards.
Solution 1:[1]
Try to put the file without a quotes and the & trailing ex.
sudo openvpn --config /home/user/config.ovpn &
This works for me.
The terminal will wait for an intro or the next command. Finally, you can disconnect with the sudo killall openvpn command.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jeremy Caney |
