Last active
August 29, 2015 14:22
-
-
Save n13i/85329e5d8f72a01236f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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