From 5b74c051e8cbc7ebf6b39106689f67ce4d2261eb Mon Sep 17 00:00:00 2001 From: vgilc Date: Thu, 14 Jul 2011 10:31:40 +0000 Subject: [PATCH] 2011-07-14 Vanessa Gil * 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 --- pandora_agents/ChangeLog | 4 ++++ pandora_agents/unix/pandora_agent | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pandora_agents/ChangeLog b/pandora_agents/ChangeLog index 349f9a61a9..e293e94c12 100644 --- a/pandora_agents/ChangeLog +++ b/pandora_agents/ChangeLog @@ -1,3 +1,7 @@ +2011-07-14 Vanessa Gil + + * unix/pandora_agent: Created runtime enviroment variables for unix agents + 2011-07-14 Vanessa Gil * win32/pandora_agent_conf.cc diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 93e0c5e2e3..c55d7e909d 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -463,7 +463,10 @@ sub read_config (;$) { if (defined ($token)) { return $2 if ($line =~ /^\s*(\S+)\s+(.*)$/ && $1 eq $token); next; - } + } + if ($line =~ /^module\s*\w*/){ + next; + } #Additional configuration file if ($line =~ /^include\s+(.*)\s*/){ open (FILE, "$1") or next; @@ -476,6 +479,7 @@ sub read_config (;$) { my $path_conf = "$ConfDir/$ConfFile"; my $path_broker = "$ConfDir/$1.conf"; my $name_agent = $1; + push (@all_conf, "$1.conf"); unless (-e $path_broker){ write_broker_conf($path_conf, $path_broker, $name_agent); @@ -1512,18 +1516,20 @@ sub kill_signal_handler (){ #Handler TERM signal. $SIG{'TERM'} = \&kill_signal_handler; - # Check command line arguments print_usage unless ($#ARGV == 0); $ConfDir = fix_directory ($ARGV[0]); error ("Directory '$ConfDir' does not exist.") unless (-d "$ConfDir"); +#Pandora home path +$ENV{'PANDORA_HOME'}=$ConfDir; + push (@all_conf, $ConfFile); foreach my $conf_agent (@all_conf){ $ConfFile = $conf_agent; - + # Get user to run as my $pandora_user = read_config ('pandora_user'); if (defined ($pandora_user)) { @@ -1550,7 +1556,10 @@ foreach my $conf_agent (@all_conf){ # Read configuration file read_config (); + + $ENV{'PANDORA_AGENT'}=$Conf{'agent_name'}; } + # Fix directory names $Conf{'temporal'} = fix_directory ($Conf{'temporal'}); error ("Temporal directory '" . $Conf{'temporal'} . "' does not exist.") unless (-d "$Conf{'temporal'}");