Created
February 20, 2015 12:59
-
-
Save tyr0chen/e17fc2d793fc1836213d to your computer and use it in GitHub Desktop.
record wan ip address for openwrt
This file contains hidden or 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/ash | |
#description:log the daily pppoe-wan ip address | |
#2014-12-2 | |
#Tyr | |
log_file=/mnt/sda3/log/wan-ip.log | |
. /lib/functions/network.sh | |
network_get_ipaddr ip wan | |
last_ip=`tail -1 $log_file|cut -f1` | |
if [ -n "$ip" -a "$last_ip" != "$ip" ];then | |
echo "$ip `date`" >>$log_file | |
else | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment