The script is:

#!/bin/bash while [ "true" ] do VPNCON=$(nmcli con status) if [[ $VPNCON != *MyVPNConnectionName* ]]; then echo "Disconnected, trying to reconnect..." (sleep 1s && nmcli con up uuid d******c-d***-4***-b***-3**********4) else echo "Already connected !" fi sleep 30 done

The UUID of your personal VPN can be found with: nmcli con

If I run this script in the terminal with bash or just copy/paste, it works great. My VPN toggles 'on' automatically, and if I turn off my VPN it toggles itself back 'on' so long as I keep my terminal open. However, if I run the script as any kind of startup script, after I reboot, the VPN will toggle 'on' then 'off' and I get a VPN Failed message. And this will keep happening at whatever duration you have set in the script. This generic script is 30secs, I set my personal one to 5secs and it toggles 'on' fails then toggles 'off' every 5secs.