Silent option for cron
This commit is contained in:
parent
d55df06068
commit
e631666cae
1 changed files with 10 additions and 2 deletions
12
dnsupdate.py
12
dnsupdate.py
|
@ -31,7 +31,7 @@ def update_or_create_record_for_zone(driver, zone, name, type, ip):
|
|||
|
||||
def run_config(config):
|
||||
cls = get_driver(Provider.AURORADNS)
|
||||
print(config)
|
||||
# logger.debug("Config {}".format(config))
|
||||
|
||||
ipv6 = requests.get('http://ip6only.me/api').text.split(',')[1]
|
||||
logger.info("IPv6: {}".format(ipv6))
|
||||
|
@ -68,10 +68,18 @@ if __name__ == '__main__':
|
|||
'-v',
|
||||
action='store_true'
|
||||
)
|
||||
argParser.add_argument(
|
||||
'--silent',
|
||||
'-s',
|
||||
action='store_true',
|
||||
help="Only log on warning (decreases verbosity). For use with cron."
|
||||
)
|
||||
|
||||
args = argParser.parse_args()
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG if args.verbose else logging.INFO)
|
||||
logLevel = logging.DEBUG if args.verbose else (logging.WARNING if args.silent else logging.INFO)
|
||||
|
||||
logging.basicConfig(level=logLevel)
|
||||
|
||||
with open(args.config, 'r') as fp:
|
||||
config = yaml.load(fp)
|
||||
|
|
Loading…
Reference in a new issue