cleanup
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
# $Id: hbd,v 1.2 2005/07/19 20:31:05 andreas Exp $
|
||||
# $Id: hbd,v 1.3 2005/07/20 14:03:46 andreas Exp $
|
||||
# Wait for heartbeat messages and act on them (or their absence)
|
||||
#
|
||||
import time, os, string, sys, socket, curses, atexit, select, SocketServer, getopt
|
||||
@@ -269,6 +269,7 @@ def readsock():
|
||||
name="unknown"
|
||||
msg=None
|
||||
interval=0
|
||||
deltaT=0.0
|
||||
for pair in pairs:
|
||||
l=string.split(pair,"=")
|
||||
key=l[0]
|
||||
@@ -288,10 +289,15 @@ def readsock():
|
||||
msg=val
|
||||
elif key == 'service':
|
||||
service=val
|
||||
elif key == 'time':
|
||||
try:
|
||||
deltaT=now-float(val)
|
||||
except:
|
||||
pass
|
||||
if boot:
|
||||
log("%s booted" % name)
|
||||
log("%s booted, deltaT %0.2g sec" % (name, deltaT))
|
||||
if msg:
|
||||
log("%s msg: %s" % (name, msg),service=service)
|
||||
log("%s %0.2g msg: %s" % (name, deltaT, msg),service=service)
|
||||
fromaddr(name, addr[0], boot, interval)
|
||||
if shutdown:
|
||||
log("%s shutdown" % name)
|
||||
|
||||
Reference in New Issue
Block a user