Skip to content

Instantly share code, notes, and snippets.

@n13i
Last active August 29, 2015 14:22
Show Gist options
  • Save n13i/85329e5d8f72a01236f2 to your computer and use it in GitHub Desktop.
Save n13i/85329e5d8f72a01236f2 to your computer and use it in GitHub Desktop.
#!/bin/vbash
source /opt/vyatta/etc/functions/script-template
SET=${SBIN_PATH}/my_set
COMMIT=${SBIN_PATH}/my_commit
configure
current_set_ipaddr=$($API returnValue vpn l2tp remote-access outside-address)
current_ext_ipaddr=$(echo -n "$(run show interfaces pppoe pppoe0)" | grep inet | cut -d' ' -f6)
echo "${current_set_ipaddr} -> ${current_ext_ipaddr}"
if [ -n "${current_ext_ipaddr}" ]; then
if [ "${current_ext_ipaddr}" != "${current_set_ipaddr}" ]; then
$SET vpn l2tp remote-access outside-address ${current_ext_ipaddr}
$COMMIT
chown -R root:vyattacfg /opt/vyatta/config/active
fi
fi
function atexit()
{
echo exit
exit
}
trap atexit EXIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment