chiark / gitweb /
fix pidfile handling
[hippotat.git] / hippotatd
index 212e5c4137e2874e75045f57e30f62a5e2de21c4..123943a9cc9092eba885ee67cf2b0202f21461a5 100755 (executable)
--- a/hippotatd
+++ b/hippotatd
@@ -361,6 +361,7 @@ def daemonise():
                    facility=facilnum,
                    logoption=syslog.LOG_PID)
     def emit(event):
+      if logevent_is_boringtwisted(event): return
       m = twisted.logger.formatEvent(event)
       #print(repr(event), m, file=org_stderr)
       level = event.get('log_level')
@@ -399,12 +400,12 @@ def daemonise():
     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)
 
-    mypid = os.getpid()
-    pfh.close()
+    if opts.pidfile is not None:
+      pidfile_h.close()
                                                                         
     logger = subprocess.Popen(['logger','-d',
                                '-t','hippotat(stderr)',