mirror of
https://codeberg.org/mclemens/nsd-dyndns.git
synced 2024-11-15 20:56:17 -05:00
first commit
This commit is contained in:
commit
4f05d03713
7
dyndns.conf-dist
Normal file
7
dyndns.conf-dist
Normal file
@ -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"
|
16
dyndns.sh
Executable file
16
dyndns.sh
Executable file
@ -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
Block a user