Starting OpenVPN on boot as a service

I’m trying to get OpenVPN to start on boot. I can run OpenVPN via the terminal fine and as a temp fix have written a quick bash script that starts the openvpn program via cron @reboot. So the script is launched every time OSMC restarts. This works fine and I know my IP is being masked by the VPN with curl ipecho.net/plain; echo.

I’ve read that putting the same *.opvn config file (which I’ve downloaded from PIA, and use susccessfuly with ``) into /etc/openvpn/ and rename to client.conf will cause OpenVPN to automatically start a connection to this profile via init.d services every time the machine boots. I’ve tested this but I’m not getting a new VPN IP.

$sudo /etc/init.d/openvpn start
[ ok ] Starting openvpn (via systemctl): openvpn.service.
osmc@osmc:/var/run/openvpn$ curl ipecho.net/plain; echo
my acutual IP.

How can I get openvpn running as a service rather than a combination of @reboot cron and bash scripts.

I’m running this on a RPi 2 with OSMC Linux 3.18.13-1-osmc.

sudo systemctl (enable/start) openvpn@vpn.service

:slight_smile: Thanks