OpenWRT
#!/bin/sh MID=<MyDNSで獲得したID> PWD=<MyDNSで獲得したパスワード> IPV4ADDR=`ip addr show dev <グローバルIPを持つデバイス> | sed -n -e "s/\s\+inet\s\+\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\)\s\+peer.*/\1/p"` URL="https://www.mydns.jp/directip.html? MID=${MID}&PWD=${PWD}&IPV4ADDR=${IPV4ADDR}" [ -f /var/log/mydns.log.1 ] && mv /var/log/mydns/mydns.log /var/log/mydns/mydns.log.2 [ -f /var/log/mydns.log ] && mv /var/log/mydns/mydns.log /var/log/mydns/mydns.log.1 date "+%Y/%m/%d %H:%M:%S" > /var/log/mydns/mydns.log curl "${URL}" >> /var/log/mydns/mydns.log
crontab -e 0 1 * * * <作成したスクリプト> 例) 0 1 * * * /opt/bin/notifyip4mydns.sh
/etc/init.d/cron restart