+if __name__ == "__main__":
+ # allow overwriting some values on the command-line
+ parser = argparse.ArgumentParser(description='Update a domain managed by a dyn-nsupdate server')
+ parser.add_argument("-c", "--config",
+ dest="config", default=os.path.join(getConfigDir(), "dyn-ns-client.conf"),
+ help="The configuration file")
+ parser.add_argument("-v", "--verbose",
+ action="store_true", dest="verbose",
+ help="Be more verbose")
+ args = parser.parse_args()
+
+ # read config
+ if not os.path.isfile(args.config):
+ raise Exception("The config file does not exist: "+args.config)
+ config = readConfig(args.config)
+
+ # get our own addresses
+ myIPv4 = getMyIPv4(config, args.verbose)
+ myIPv6 = getMyIPv6(config, args.verbose)
+
+ # update all the domains
+ exitcode = 0
+ domains = map(str.strip, config['DEFAULT']['domains'].split(','))
+ if not domains:
+ raise Exception("No domain given to update!")
+ for domain in domains:
+ if not updateDomain(config['DEFAULT']['server'], domain, myIPv4, myIPv6, config['DEFAULT']['password'], verbose=args.verbose):
+ exitcode = 1
+ sys.exit(exitcode)