chiark / gitweb /
config: fix client config (no SERVER)
[hippotat.git] / hippotatd
index 834dc5d473169631e3885426ada81f4dd7c2cb37..fe10eeca6166186c49af06ae6da93d8b45a35dde 100755 (executable)
--- a/hippotatd
+++ b/hippotatd
@@ -296,7 +296,8 @@ def process_cfg(_opts, putative_servers, putative_clients):
 
   global c
   c = ConfigResults()
 
   global c
   c = ConfigResults()
-  c.server = cfg.get('SERVER','server')
+  try: c.server = cfg.get('SERVER','server')
+  except NoOptionError: c.server = 'SERVER'
 
   cfg_process_common(c, c.server)
   cfg_process_saddrs(c, c.server)
 
   cfg_process_common(c, c.server)
   cfg_process_saddrs(c, c.server)
@@ -400,16 +401,15 @@ def daemonise():
     if grandchildpid:
       # we are the intermediate child
       if opts.pidfile is not None:
     if grandchildpid:
       # we are the intermediate child
       if opts.pidfile is not None:
-        print(grandchildpid, file=pfh)
-        pfh.close()
+        print(grandchildpid, file=pidfile_h)
+        pidfile_h.close()
       os._exit(0)
 
       os._exit(0)
 
-    mypid = os.getpid()
-    pfh.close()
+    if opts.pidfile is not None:
+      pidfile_h.close()
                                                                         
     logger = subprocess.Popen(['logger','-d',
                                                                         
     logger = subprocess.Popen(['logger','-d',
-                               '-t','hippotat(stderr)',
-                               '--id=%d' % mypid,
+                               '-t','hippotat[%d](stderr)' % os.getpid(),
                                '-p',opts.syslogfacility + '.err'],
                               stdin=subprocess.PIPE,
                               stdout=subprocess.DEVNULL,
                                '-p',opts.syslogfacility + '.err'],
                               stdin=subprocess.PIPE,
                               stdout=subprocess.DEVNULL,