- decouple recover interval and input timeout
authorAleš Křenek <ljocha@ics.muni.cz>
Thu, 26 Nov 2009 15:59:41 +0000 (15:59 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Thu, 26 Nov 2009 15:59:41 +0000 (15:59 +0000)
- cleanup pidfile on exit
- update man page

org.glite.lb.logger/doc/glite-lb-interlogd.8
org.glite.lb.logger/src/il_master.c
org.glite.lb.logger/src/interlogd.c
org.glite.lb.logger/src/interlogd.h
org.glite.lb.logger/src/recover.c

index d294ec7..1f6a013 100644 (file)
@@ -68,6 +68,10 @@ environment variable.
 Don't run as daemon (do not fork and put itself into background).
 
 .TP
+.BI \-i " FILE" "\fR,\fP --pidfile " FILE
+Store process id into this file rather than default /var/glite/glite-lb-[notif]-interlogd.pid
+
+.TP
 .BI \-f " PREFIX" "\fR,\fP --file-prefix " PREFIX
 .I PREFIX 
 is path prefix of the event files.
index 384c89a..fa5cbf0 100644 (file)
@@ -3,6 +3,7 @@
 #include <errno.h>
 #include <string.h>
 #include <unistd.h>
+#include <stdio.h>
 
 #include "glite/jobid/cjobid.h"
 #include "glite/lb/context.h"
@@ -438,7 +439,7 @@ loop()
                int ret;
     
                if(killflg)
-                       exit(0);
+                       return (0);
 
                clear_error();
                if((ret = input_queue_get(&msg, &offset, INPUT_TIMEOUT)) < 0) 
index 220470e..0dac6ea 100644 (file)
@@ -420,11 +420,13 @@ main (int argc, char **argv)
     il_log(LOG_CRIT, "Fatal error: %s\n", error_get_msg());
     if (killflg) {
       input_queue_detach();
+      unlink(pidfile);
       exit(EXIT_FAILURE);
     }
   }
   il_log(LOG_INFO, "Done!\n");
   input_queue_detach();
+  unlink(pidfile);
 
   exit (0);
 }
index b2fdde4..2ca26ea 100644 (file)
@@ -60,7 +60,8 @@
 
 // #define TIMEOUT      5
 extern int TIMEOUT;
-#define INPUT_TIMEOUT (60)
+#define INPUT_TIMEOUT (5)
+#define RECOVER_TIMEOUT (60)
 #define EXIT_TIMEOUT (1*60)
 
 typedef struct cred_handle {
index 18fc3b4..7543b3b 100644 (file)
@@ -60,6 +60,6 @@ recover_thread(void *q)
                                il_log(LOG_INFO, "New certificate found and deployed.\n");
                        }
                }
-               sleep(INPUT_TIMEOUT);
+               sleep(RECOVER_TIMEOUT);
        }
 }