Skip to content

Instantly share code, notes, and snippets.

@tyr0chen
Created February 20, 2015 12:59
Show Gist options
  • Save tyr0chen/e17fc2d793fc1836213d to your computer and use it in GitHub Desktop.
Save tyr0chen/e17fc2d793fc1836213d to your computer and use it in GitHub Desktop.
record wan ip address for openwrt
#!/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