Author: rfm
Date: Wed Mar 26 17:55:03 2014
New Revision: 37771

URL: http://svn.gna.org/viewcvs/gnustep?rev=37771&view=rev
Log:
record ControlVersion

Modified:
    libs/ec/trunk/ECCL.h
    libs/ec/trunk/EcControl.m

Modified: libs/ec/trunk/ECCL.h
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/ECCL.h?rev=37771&r1=37770&r2=37771&view=diff
==============================================================================
--- libs/ec/trunk/ECCL.h        (original)
+++ libs/ec/trunk/ECCL.h        Wed Mar 26 17:55:03 2014
@@ -45,6 +45,15 @@
           a central command/control point and acts as the SNMP agent for
           integration of a cluster of Objective-C based processes.
         </p> 
+        <p>On startup, (or configuration change) the configuration dictionary
+          from Control.plist (plus any included files) is written to
+          /tmp/Control.cnf to provide a record of the latest config.
+        </p>
+        <p>Periodically, the file /tmp/Control.alive is updated to indicate
+          that the process is still running correctly.  If the user default
+          string ControlVersion is defined, it is written to one line of
+          this file and in any case a timestamp is written.
+        </p>
       </section>
 
       <section>

Modified: libs/ec/trunk/EcControl.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/EcControl.m?rev=37771&r1=37770&r2=37771&view=diff
==============================================================================
--- libs/ec/trunk/EcControl.m   (original)
+++ libs/ec/trunk/EcControl.m   Wed Mar 26 17:55:03 2014
@@ -2267,6 +2267,9 @@
   [[self cmdLogFile: logname] synchronizeFile];
   if (inTimeout == NO)
     {
+      NSString  *alive;
+      NSString  *mesg;
+      NSString  *ver;
       unsigned count;
 
       inTimeout = YES;
@@ -2347,10 +2350,21 @@
       /*
        * Write heartbeat file to let external programs know we are alive.
        */
-      [[NSString stringWithFormat: @"Heartbeat: %@\n", now]
-       writeToFile: [NSString stringWithFormat: @"/tmp/%@.alive",
-         [self cmdName]]
-       atomically: YES];
+      ver = [[self cmdDefaults] stringForKey: @"ControlVersion"];
+      if (nil == ver)
+        {
+          mesg = [NSString stringWithFormat: @"Heartbeat: %@\n", now];
+        }
+      else
+        {
+          mesg = [NSString stringWithFormat: @"Heartbeat: %@\nVersion: %@\n",
+            now, ver];
+        }
+      alive = [NSString stringWithFormat: @"/tmp/%@.alive", [self cmdName]];
+      [mesg writeToFile: alive atomically: YES];
+      [mgr changeFileAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
+        [NSNumber numberWithInt: 0666], NSFilePosixPermissions,
+        nil] atPath: alive];
     }
   [self reportAlarms];
   inTimeout = NO;
@@ -2798,7 +2812,11 @@
        * applications/classes levels of the configuration.
        */
       conf = [self recursiveInclude: conf];
-      [conf writeToFile: @"/tmp/control.log" atomically: YES];
+      [conf writeToFile: @"/tmp/Control.cnf" atomically: YES];
+      [mgr changeFileAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
+        [NSNumber numberWithInt: 0666], NSFilePosixPermissions,
+        nil] atPath: @"/tmp/Control.cnf"];
+
       root = [NSMutableDictionary dictionaryWithCapacity: [conf count]];
       rootEnum = [conf keyEnumerator];
       while ((hostKey = [rootEnum nextObject]) != nil)
@@ -2809,6 +2827,7 @@
          NSString              *appKey;
 
          rootObj = [conf objectForKey: hostKey];
+
          if ([rootObj isKindOfClass: [NSDictionary class]] == NO)
            {
              NSString  *e;


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to