IPTable Kill Switch Script to detect and reset OpenVPN automatically

Hi,

2 ways of doing this, one way is to use systemd; details can be found here:

being as you specifically requested a script an other option could be:

#!/bin/bash
ps -ef | grep -v grep | grep openvpn
if [ $? -eq 1 ] ; then
systemctl restart openvpn
fi

The script checks to see if openvpn is still running and if not restarts it. Just set a cron job to check how often required.

Thanks Tom.

1 Like