mirror of
https://github.com/gnustep/libs-ec.git
synced 2025-02-20 18:32:09 +00:00
record ControlVersion
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/ec/trunk@37771 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a85e405a68
commit
1e32f3b7a1
2 changed files with 33 additions and 5 deletions
9
ECCL.h
9
ECCL.h
|
@ -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>
|
||||
|
|
29
EcControl.m
29
EcControl.m
|
@ -2267,6 +2267,9 @@ static NSString* cmdWord(NSArray* a, unsigned int pos)
|
|||
[[self cmdLogFile: logname] synchronizeFile];
|
||||
if (inTimeout == NO)
|
||||
{
|
||||
NSString *alive;
|
||||
NSString *mesg;
|
||||
NSString *ver;
|
||||
unsigned count;
|
||||
|
||||
inTimeout = YES;
|
||||
|
@ -2347,10 +2350,21 @@ static NSString* cmdWord(NSArray* a, unsigned int pos)
|
|||
/*
|
||||
* 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 @@ static NSString* cmdWord(NSArray* a, unsigned int pos)
|
|||
* 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 @@ static NSString* cmdWord(NSArray* a, unsigned int pos)
|
|||
NSString *appKey;
|
||||
|
||||
rootObj = [conf objectForKey: hostKey];
|
||||
|
||||
if ([rootObj isKindOfClass: [NSDictionary class]] == NO)
|
||||
{
|
||||
NSString *e;
|
||||
|
|
Loading…
Reference in a new issue