python 2.0 fixes
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/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)
|
# 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
|
False=0
|
||||||
True=1
|
True=1
|
||||||
@@ -227,7 +227,7 @@ def display():
|
|||||||
displaymsgs()
|
displaymsgs()
|
||||||
|
|
||||||
def log(m, service="heartbeat"):
|
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)
|
msgs.append(msg)
|
||||||
if logfmt == "msg":
|
if logfmt == "msg":
|
||||||
m2="%d|%s|%s\n" % (now, service, m)
|
m2="%d|%s|%s\n" % (now, service, m)
|
||||||
@@ -470,6 +470,7 @@ if f:
|
|||||||
l=f.readline()
|
l=f.readline()
|
||||||
if len(l) == 0:
|
if len(l) == 0:
|
||||||
break
|
break
|
||||||
|
if verbose: print " %s" % l[:-1]
|
||||||
r=l[:-1].split('=')
|
r=l[:-1].split('=')
|
||||||
if r[0] == 'interval':
|
if r[0] == 'interval':
|
||||||
interval=eval(r[1])
|
interval=eval(r[1])
|
||||||
@@ -494,6 +495,7 @@ if len(args) != 0:
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
if verbose: print "notice: logging to %s" % logfile
|
||||||
logf=initlog(logfile)
|
logf=initlog(logfile)
|
||||||
|
|
||||||
now=time.time()
|
now=time.time()
|
||||||
@@ -501,12 +503,13 @@ startsec=int(now) % interval
|
|||||||
|
|
||||||
htab={}
|
htab={}
|
||||||
if visual:
|
if visual:
|
||||||
|
import curses
|
||||||
initcurses()
|
initcurses()
|
||||||
display()
|
display()
|
||||||
stdscr.nodelay(1)
|
stdscr.nodelay(1)
|
||||||
|
|
||||||
|
if verbose: log("Starting")
|
||||||
atexit.register(on_exit)
|
atexit.register(on_exit)
|
||||||
if DEBUG: log("Starting")
|
|
||||||
|
|
||||||
ilist=[]
|
ilist=[]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user