2011-07-14 Vanessa Gil <vanessa.gil@artica.es>

* unix/pandora_agent: Created runtime enviroment variables for unix agents



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4564 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2011-07-14 10:31:40 +00:00
parent 43f6877b56
commit d836b86728
2 changed files with 16 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2011-07-14 Vanessa Gil <vanessa.gil@artica.es>
* unix/pandora_agent: Created runtime enviroment variables for unix agents
2011-07-14 Vanessa Gil <vanessa.gil@artica.es> 2011-07-14 Vanessa Gil <vanessa.gil@artica.es>
* win32/pandora_agent_conf.cc * win32/pandora_agent_conf.cc

View File

@ -463,7 +463,10 @@ sub read_config (;$) {
if (defined ($token)) { if (defined ($token)) {
return $2 if ($line =~ /^\s*(\S+)\s+(.*)$/ && $1 eq $token); return $2 if ($line =~ /^\s*(\S+)\s+(.*)$/ && $1 eq $token);
next; next;
} }
if ($line =~ /^module\s*\w*/){
next;
}
#Additional configuration file #Additional configuration file
if ($line =~ /^include\s+(.*)\s*/){ if ($line =~ /^include\s+(.*)\s*/){
open (FILE, "$1") or next; open (FILE, "$1") or next;
@ -476,6 +479,7 @@ sub read_config (;$) {
my $path_conf = "$ConfDir/$ConfFile"; my $path_conf = "$ConfDir/$ConfFile";
my $path_broker = "$ConfDir/$1.conf"; my $path_broker = "$ConfDir/$1.conf";
my $name_agent = $1; my $name_agent = $1;
push (@all_conf, "$1.conf"); push (@all_conf, "$1.conf");
unless (-e $path_broker){ unless (-e $path_broker){
write_broker_conf($path_conf, $path_broker, $name_agent); write_broker_conf($path_conf, $path_broker, $name_agent);
@ -1512,18 +1516,20 @@ sub kill_signal_handler (){
#Handler TERM signal. #Handler TERM signal.
$SIG{'TERM'} = \&kill_signal_handler; $SIG{'TERM'} = \&kill_signal_handler;
# Check command line arguments # Check command line arguments
print_usage unless ($#ARGV == 0); print_usage unless ($#ARGV == 0);
$ConfDir = fix_directory ($ARGV[0]); $ConfDir = fix_directory ($ARGV[0]);
error ("Directory '$ConfDir' does not exist.") unless (-d "$ConfDir"); error ("Directory '$ConfDir' does not exist.") unless (-d "$ConfDir");
#Pandora home path
$ENV{'PANDORA_HOME'}=$ConfDir;
push (@all_conf, $ConfFile); push (@all_conf, $ConfFile);
foreach my $conf_agent (@all_conf){ foreach my $conf_agent (@all_conf){
$ConfFile = $conf_agent; $ConfFile = $conf_agent;
# Get user to run as # Get user to run as
my $pandora_user = read_config ('pandora_user'); my $pandora_user = read_config ('pandora_user');
if (defined ($pandora_user)) { if (defined ($pandora_user)) {
@ -1550,7 +1556,10 @@ foreach my $conf_agent (@all_conf){
# Read configuration file # Read configuration file
read_config (); read_config ();
$ENV{'PANDORA_AGENT'}=$Conf{'agent_name'};
} }
# Fix directory names # Fix directory names
$Conf{'temporal'} = fix_directory ($Conf{'temporal'}); $Conf{'temporal'} = fix_directory ($Conf{'temporal'});
error ("Temporal directory '" . $Conf{'temporal'} . "' does not exist.") unless (-d "$Conf{'temporal'}"); error ("Temporal directory '" . $Conf{'temporal'} . "' does not exist.") unless (-d "$Conf{'temporal'}");