$HOME is not set correctly for plug-ins

Alexander Haas alex at geloet.de
Wed Nov 24 21:39:44 CET 2010


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

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list