I did quite a bit of googling before a solution came to me, i did find it on the page: Turn your Raspberry Pi into a VPN gateway.
Here is a overview of the solution (slightly modified for the original):
First remove the normal start and stop hooks in rc*.d
sudo update-rc.d danted remove
Next create the scripts.
sudo mkdir /etc/dante_scripts sudo nano /etc/dante_scripts/myprovider.up
Add the following contents to
/etc/dante_scripts/myprovider.up
:#!/bin/bash if [ "$1" = tun0 ]; then /etc/init.d/danted start fi
sudo nano /etc/dante_scripts/myprovider.down
Add the following contents to
/etc/dante_scripts/myprovider.down
:#!/bin/bash if [ "$1" = tun0 ]; then /etc/init.d/danted stop fi
Make the scripts runnable:
sudo chmod +x /etv/dante_scripts/*
Add the hooks to
/etc/default/openvpn
:sudo nano /etc/default/openvpn
Modify the OPTARGS:
OPTARGS="--up /etc/dante_scripts/myprovider.up --down /etc/dante_scripts/myprovider.down"