<?php
echo $_SERVER['REMOTE_ADDR'];
?>
bin/sh
LINODE_API_KEY=your linode key
DOMAIN_ID=your domain id
RESOURCE_ID=your resource id
# Ask your linode what your current home/remote WAN IP is
WAN_IP=`wget -O - -q http://www.yourlinode.com/MyIP.php`
# Get your old WAN IP
OLD_WAN_IP=`cat /var/CURRENT_WAN_IP.txt`
# See if the new IP is the same as the old IP.
if [ "$WAN_IP" = "$OLD_WAN_IP" ]; then
echo "IP Unchanged"
# Don't do anything if th eIP didn't change
else
# The IP changed. Update Linode's DNS to show the new IP
echo $WAN_IP > /var/CURRENT_WAN_IP.txt
wget -qO- https://api.linode.com/?api_key="$LINODE_API_KEY"\&api_action=domain.resource.update\&DomainID="$DOMAIN_ID"\&ResourceID="$RESOURCE_ID"\&Target="$WAN_IP"
fi
网友评论