diff --git a/Control.plist b/Control.plist index f0fa6c7..3cc6619 100644 --- a/Control.plist +++ b/Control.plist @@ -127,6 +127,7 @@ Time = 30; // Interval for relaunching after crash }; }; + /* Specify launch order ... Feep first, Bar second * Processes not listed here are launched in lexicographical order * after any processes which are listed. @@ -135,11 +136,13 @@ Feep, // Launch Feep first Bar // Launch Bar second ); + /* Specify how many tasks the Command server may have launching * concurrently (default is 20). You may want to set this to a * lower value in order to reduce load when the system start up. */ LaunchLimit = 20; + /* Specify whether, when the Command server starts, launching of * tasks should be suspeneded (as if the 'suspend' command had been * sent to it from the Console). @@ -147,6 +150,20 @@ */ LaunchStartSuspended = NO; + /* Optionally specify an alternative default environment for launched + * processes. If this is not set then the environment in which the + * Command server was launched is used. + * SetE = { + * }; + */ + + /* Optionally specify additions to the default environment for launched + * processes. This is typically used to modify the information that + * comes from the enveironment the Command server was launched in. + * AddE = { + * }; + */ + /* Configure all tasks to be run under valgrind specifying the path * to the process, which may be overridden on a per-process basis * in the Launch config. Setting ValgrindPath to an empty string diff --git a/EcCommand.m b/EcCommand.m index 5979e33..4dcbc68 100644 --- a/EcCommand.m +++ b/EcCommand.m @@ -519,9 +519,13 @@ desiredName(Desired state) * Defaults to 180, but logs may still be deleted as if this were set * to CompressLogsAfter if NodesFree or SpaceFree is reached. * - * Environment + * SetE * A dictionary setting the default environment for launched processes. * + * AddE + * A dictionary overriding parts of the default environment for launched + * processes. + * * Launch * A dictionary describing the processes which the server is responsible * for launching. @@ -4064,13 +4068,29 @@ NSLog(@"Problem %@", localException); ASSIGNCOPY(launchOrder, newOrder); } - o = [d objectForKey: @"Environment"]; - if ([o isKindOfClass: [NSDictionary class]] == NO) + o = [d objectForKey: @"SetE"]; + if (o != nil && NO == [o isKindOfClass: [NSDictionary class]]) + { + NSLog(@"Bad global 'SetE' information in latest config update"); + o = nil; + } + if (nil == o) + { + o = [[NSProcessInfo processInfo] environment]; + } + NSMutableDictionary *env = [o mutableCopy]; + + o = [d objectForKey: @"AddE"]; + if (o != nil && [o isKindOfClass: [NSDictionary class]] == NO) { - NSLog(@"No 'Environment' information in latest config update"); + NSLog(@"Bad global 'AddE' information in latest config update"); o = nil; } - ASSIGN(environment, o); + if (o) + { + [env addEntriesFromDictionary: o]; + } + ASSIGN(environment, env); k = [d objectForKey: @"NodesFree"]; if (YES == [k isKindOfClass: [NSString class]])