Skip to content

Instantly share code, notes, and snippets.

@Snuggle
Last active May 25, 2024 07:03
Show Gist options
  • Save Snuggle/0ed1d19395162e6816dac32f325869e9 to your computer and use it in GitHub Desktop.
Save Snuggle/0ed1d19395162e6816dac32f325869e9 to your computer and use it in GitHub Desktop.
if [ "$(ifconfig | grep 217.169.20.20)" ]; then
echo "L2TP Tunnel is UP"
else
echo "L2TP Tunnel is DOWN"
echo "Restarting interface"
/usr/local/etc/rc.linkup stop l2tp0
/usr/local/etc/rc.linkup start l2tp0
echo "Killing existing process"
kill $(cat /var/run/l2tp_opt2.pid)
sleep 5
echo "Running mpd5"
/usr/local/sbin/mpd5 -b -d /var/etc -f mpd_opt2.conf -p /var/run/l2tp_opt2.pid -s ppp l2tpclient # https://github.com/opnsense/core/blob/master/src/etc/inc/interfaces.inc
echo "L2TP Tunnel has been restarted"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment