2018-04-29 14:39:07 -04:00
|
|
|
#!/usr/local/bin/bash
|
|
|
|
|
|
|
|
. /etc/dyndns.conf
|
|
|
|
|
2018-04-29 15:41:01 -04:00
|
|
|
REQ_IP=$(/usr/bin/grep ${PASS} ${LOG} | /usr/bin/tail -1 | /usr/bin/awk '{print $2}')
|
2018-04-29 14:39:07 -04:00
|
|
|
|
|
|
|
if [ -f $LAST_IP_FILE ]; then
|
2018-04-29 15:41:01 -04:00
|
|
|
LAST_IP=$(/bin/cat $LAST_IP_FILE)
|
2018-04-29 14:39:07 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $LAST_IP != $REQ_IP ]]; then
|
2018-04-29 15:41:01 -04:00
|
|
|
/bin/cat $ZONEFILE | /usr/bin/sed "4s/.*/${TIMESTAMP}/" | /usr/bin/sed "s/^${SUBDOMAIN}.*/${SUBDOMAIN} IN A ${REQ_IP}/" > $ZONEFILE
|
2018-04-29 14:39:07 -04:00
|
|
|
/etc/rc.d/nsd reload
|
2018-04-29 15:41:01 -04:00
|
|
|
/bin/echo $REQ_IP > $LAST_IP_FILE
|
|
|
|
/bin/echo "update"
|
2018-04-29 14:39:07 -04:00
|
|
|
fi
|