On my PI i have OpenVPN and it is configured to run using a tun (bridge) interface. In order for this to work, I have to run a script that I have created before the OpenVPN service starts so that the tun interface can be setup and OpenVPN can then use it. If I start my box, and then run my script and start OpenVPN, OpenVPN works how I want it to.
So I want to automate this on my headless setup, so that when the PI boots and the OpenVPN service is started automatically (init.d) at boot time, the script is run and OpenVPN will be able to use the interfaces setup by the script.
Originally, I had edited the /etc/init.d/openvpn code to manually add in my bash script so that it would be run on service startup so it worked fine, however the problem with this is that any OpenVPN updates mean I have to go in a redo this work.
To get around this I though I could use an upstart conf file (/etc/init) that is configured to fire on service startup for OpenVPN, however I don't think the PI uses upstart but systemd-sysv instead.
How should I go about running this script? I also have a script to tear down the tun interface for when I stop OpenVPN, however maybe I don't actually need to do this, and just leave the tun device up and running through out the uptime of the PI.