s3:net_idmap_delete do not lock two records at the same time
[Samba/gebeck_regimport.git] / lib / dnspython / examples / ddns.py
blob84814b73cf6cffa9edd7c120c0388f2fe7db0ad9
1 #!/usr/bin/env python
4 # Use a TSIG-signed DDNS update to update our hostname-to-address
5 # mapping.
7 # usage: ddns.py <ip-address>
9 # On linux systems, you can automatically update your DNS any time an
10 # interface comes up by adding an ifup-local script that invokes this
11 # python code.
13 # E.g. on my systems I have this
15 # #!/bin/sh
17 # DEVICE=$1
19 # if [ "X${DEVICE}" == "Xeth0" ]; then
20 # IPADDR=`LANG= LC_ALL= ifconfig ${DEVICE} | grep 'inet addr' |
21 # awk -F: '{ print $2 } ' | awk '{ print $1 }'`
22 # /usr/local/sbin/ddns.py $IPADDR
23 # fi
25 # in /etc/ifup-local.
28 import sys
30 import dns.update
31 import dns.query
32 import dns.tsigkeyring
35 # Replace the keyname and secret with appropriate values for your
36 # configuration.
38 keyring = dns.tsigkeyring.from_text({
39 'keyname.' : 'NjHwPsMKjdN++dOfE5iAiQ=='
43 # Replace "example." with your domain, and "host" with your hostname.
45 update = dns.update.Update('example.', keyring=keyring)
46 update.replace('host', 300, 'A', sys.argv[1])
49 # Replace "10.0.0.1" with the IP address of your master server.
51 response = dns.query.tcp(update, '10.0.0.1', timeout=10)