first commit
This commit is contained in:
commit
4f05d03713
|
@ -0,0 +1,7 @@
|
||||||
|
PASS="qwertzuiop1234567890"
|
||||||
|
LOG=/var/www/logs/dyndns.log
|
||||||
|
LAST_IP="none"
|
||||||
|
LAST_IP_FILE=/tmp/last_dyndns_ip.txt
|
||||||
|
TIMESTAMP=$(date +%s)
|
||||||
|
ZONEFILE=/var/nsd/zones/dyndns.org.zone
|
||||||
|
SUBDOMAIN="blah"
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/local/bin/bash
|
||||||
|
|
||||||
|
. /etc/dyndns.conf
|
||||||
|
|
||||||
|
REQ_IP=$(grep ${PASS} ${LOG} | tail -1 | awk '{print $2}')
|
||||||
|
|
||||||
|
if [ -f $LAST_IP_FILE ]; then
|
||||||
|
LAST_IP=$(cat $LAST_IP_FILE)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $LAST_IP != $REQ_IP ]]; then
|
||||||
|
cat $ZONEFILE | sed "4s/.*/${TIMESTAMP}/" | sed "s/^${SUBDOMAIN}.*/${SUBDOMAIN} IN A ${REQ_IP}/" > $ZONEFILE
|
||||||
|
/etc/rc.d/nsd reload
|
||||||
|
echo $REQ_IP > $LAST_IP_FILE
|
||||||
|
echo "update"
|
||||||
|
fi
|
Loading…
Reference in New Issue