optionally set name via name= directive in rc file

This commit is contained in:
andreas
2006-04-28 12:13:39 +00:00
parent f9bd84f7cc
commit 72b60c2665
+5 -2
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python
# $Id: hbc,v 1.5 2005/07/21 15:27:05 andreas Exp $
# $Id: hbc,v 1.6 2006/04/28 12:13:39 andreas Exp $
import sys, time, socket, os, signal, getopt, string
PORT=50003
@@ -79,6 +79,7 @@ reportstrict={True|False}
hb_port=PORT
interval=INTERVAL
hb_hosts=[]
iam=socket.gethostname()
try:
f=open(configfile,"r")
@@ -101,6 +102,9 @@ if f:
interval=eval(r[1])
elif r[0] == 'hb_port':
hb_port=eval(r[1])
elif r[0] == 'name':
iam=eval(r[1])
if verbose: print "name set to %s" % iam
f.close()
if len(args) != 0:
@@ -112,7 +116,6 @@ if len(hb_hosts) == 0:
sock=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
iam=socket.gethostname()
if verbose:
print "notice: hb_hosts: %s" % str(hb_hosts)