2012-04-18 Dario Rodriguez <dario.rodriguez@artica.es>

* unix/pandora_agent: Fixed a problem detecting agent user to launch
	proxy mode. Added logger function when an error occurs.

	MERGED FROM 4.0.2



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6019 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
darode 2012-04-18 14:13:41 +00:00
parent d7f5a9d320
commit d45486d4ed
2 changed files with 19 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2012-04-18 Dario Rodriguez <dario.rodriguez@artica.es>
* unix/pandora_agent: Fixed a problem detecting agent user to launch
proxy mode. Added logger function when an error occurs.
MERGED FROM 4.0.2
2012-04-04 Ramon Novoa <rnovoa@artica.es>
* unix/tentacle_client,

View File

@ -227,6 +227,7 @@ sub print_usage () {
sub error ($) {
my $msg = shift;
print ("[ERROR] $msg\n\n");
`logger -i -t pandora_agent_daemon [ERROR] $msg 2>/dev/null`;
exit 1;
}
@ -301,7 +302,16 @@ sub log_message ($$;$) {
if (defined ($dest)) {
print $dest strftime ('%Y/%m/%d %H:%M:%S', localtime ()) . " - [$source] - $msg\n";
} else {
print $LogFileFH strftime ('%Y/%m/%d %H:%M:%S', localtime ()) . " - [$source] - $msg\n";
#Trying to write into log file to test its writable
syswrite ($LogFileFH, "");
#If no error, the file is writable
if (!$!) {
print $LogFileFH strftime ('%Y/%m/%d %H:%M:%S', localtime ()) . " - [$source] - $msg\n";
} else {
#If error then log into syslog!
`logger -i -t pandora_agent_daemon [ERROR] $msg 2>/dev/null`;
}
}
}
@ -1740,7 +1750,7 @@ my $PID = $$;
if ($Conf{'proxy_mode'}) {
#Check if user is root
if ($< != 0) {
if ($> != 0) {
launch_tentacle_proxy();
} else {
error ('Proxy mode can not be launched as root');