From 54b7faa3e78e8e2defd34b0a65d3a48f2bdce705 Mon Sep 17 00:00:00 2001 From: Andreas Wrede Date: Mon, 2 May 2016 10:27:46 -0400 Subject: [PATCH 1/3] log only when verbose --- hbc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hbc b/hbc index 2b2c33c..587cd53 100755 --- a/hbc +++ b/hbc @@ -472,11 +472,11 @@ if not msgonly: conns = {} while True: - log(" create connections") + if verbose: log("create connections") createConnections(hb_hosts) if len(conns) != 0: break - log(" no connections yet, sleep a bit") + if verbose: log("no connections yet, sleep a bit") time.sleep(2) if verbose: From 7cb3717176da357e72f84d17f542f252a54caa95 Mon Sep 17 00:00:00 2001 From: Andreas Wrede Date: Wed, 15 Jan 2020 16:38:42 -0500 Subject: [PATCH 2/3] make nsupdate bin configurable --- hbd | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hbd b/hbd index a0d286f..192a7bc 100755 --- a/hbd +++ b/hbd @@ -34,6 +34,8 @@ from subprocess import Popen, STDOUT, PIPE import hbdclass +NSUPDATE_BIN = "/usr/local/bin/nsupdate" # override in .hbrc possible + SEND_EMAIL=False SEND_PUSHOVER=True @@ -241,7 +243,7 @@ answer """ % D if DEBUG > 0: log(None, "DBG: nsup %s" % nsup) - cmd = ["/usr/local/bin/nsupdate", "-k", "/etc/dhcpc/K%(domain)s.+157+00000." % D, "-v"] + cmd = [nsupdate_bin, "-k", "/etc/dhcpc/K%(domain)s.+157+00000." % D, "-v"] if DEBUG > 0: log(None, "DBG: cmd %s" % cmd) try: p = Popen(cmd, shell=False, bufsize=1, stdin=PIPE, stdout=PIPE, stderr=STDOUT) @@ -251,9 +253,9 @@ answer return "nsupdate: some error occured" (output, err) = p.communicate(nsup.encode()) - if output.find('status: NOERROR') >= 0: + if output.decode().find('status: NOERROR') >= 0: return None - return output + return output.decode() # @@ -826,6 +828,7 @@ grace = GRACE watchhosts = [] dyndnshosts = [] drophosts = [] +nsupdate_bin = NSUPDATE_BIN try: f = open(configfile, "r") @@ -874,6 +877,8 @@ if f: dyndnshosts = a elif o == 'drophosts': drophosts = a + elif o == 'nsupdate_bin': + nsupdate_bin = a f.close() if len(args) != 0: From 439111f53f6288d1c5661c79aa1c913f9aa59734 Mon Sep 17 00:00:00 2001 From: Andreas Wrede Date: Sun, 26 Jan 2020 14:37:31 -0500 Subject: [PATCH 3/3] force use of python3 --- hbc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hbc b/hbc index c47c4f1..ef4b1fb 100755 --- a/hbc +++ b/hbc @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # $Id: hbc,v 1.9 2012/03/29 02:08:36 andreas Exp $ # NEW import sys