From 2806f2fde1c81abb1d50428f99162127500ef0d3 Mon Sep 17 00:00:00 2001 From: andreas Date: Thu, 21 Jul 2005 18:07:33 +0000 Subject: [PATCH] python 2.0 fixes --- hbd | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hbd b/hbd index 19c8e86..0e9def2 100755 --- a/hbd +++ b/hbd @@ -1,8 +1,8 @@ #!/usr/bin/env python -# $Id: hbd,v 1.6 2005/07/21 17:01:28 andreas Exp $ +# $Id: hbd,v 1.7 2005/07/21 18:07:33 andreas Exp $ # Wait for heartbeat messages and act on them (or their absence) # -import time, os, string, sys, socket, curses, atexit, select, SocketServer, getopt +import time, os, string, sys, socket, atexit, select, SocketServer, getopt False=0 True=1 @@ -227,7 +227,7 @@ def display(): displaymsgs() def log(m, service="heartbeat"): - msg=time.strftime("%b %d %H:%M:%S")+": "+m+"\n" + msg=time.strftime("%b %d %H:%M:%S", time.localtime(time.time()))+": "+m+"\n" msgs.append(msg) if logfmt == "msg": m2="%d|%s|%s\n" % (now, service, m) @@ -470,6 +470,7 @@ if f: l=f.readline() if len(l) == 0: break + if verbose: print " %s" % l[:-1] r=l[:-1].split('=') if r[0] == 'interval': interval=eval(r[1]) @@ -494,6 +495,7 @@ if len(args) != 0: sys.exit(1) +if verbose: print "notice: logging to %s" % logfile logf=initlog(logfile) now=time.time() @@ -501,12 +503,13 @@ startsec=int(now) % interval htab={} if visual: + import curses initcurses() display() stdscr.nodelay(1) +if verbose: log("Starting") atexit.register(on_exit) -if DEBUG: log("Starting") ilist=[]