|
From: Alexander H. <al...@ge...> - 2010-11-24 20:55:32
|
Hi Nagios users,
this is my first post. I encountered a behavior I am not able to
understand. Well, I guess I did understand it, but I don't know how to
counter it :)
When I write a plug-in for Nagios it is executed as nagios:nagios. Yet
$HOME is set to "/root".
My /etc/password and nagios's home-directory are ok. It works well when
I log in as user nagios and execute the plug-in there.
I did expect to find some attributes for command definitions to set the
home directory, but I could not find any.
I guess the whole thing has to do with su and the way it does (not)
handle the home directory or environment in general.
Currently I work around that behavior using this code:
if [ "$HOME" == "/root" ] && [ "`whoami`" == "nagios" ]
then
HOME="/usr/local/nagios"
fi
But as you might guess I am not very satisfied.
Thanks in advance,
Alex
|