python 2.0 fixes
This commit is contained in:
@@ -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=[]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user