<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hi Jon,<br>
    <br>
    thank you for getting back on me. Of course I did do a su - nagios
    for my tests. I fact all my console tests run fine. I think it's
    Nagois doing some kind of su in its internals which causes my
    plug-in to get a wrong $HOME inherited. The bad behavior only occurs
    when executed by the actual Nagios setup.<br>
    <br>
    Best,<br>
    <br>
    Alex<br>
    <br>
    <br>
    On 24.11.2010 22:04, Jon Adcock wrote:
    <blockquote cite="mid:4CED378302000075000304D1@leoncountyfl.gov"
      type="cite">
      <meta http-equiv="Context-Type" content="text/html;
        charset=US-ASCII">
      <div>Alexander,</div>
      <div> </div>
      <div>  It sounds like you are saying that you login as root, then
        su to nagios.  If that's the case, make sure that you use su -
        nagios</div>
      <div>The hyphen tells su to use the environmental variables of the
        user that you are switching to.  Without using the hyphen, it
        continues to use the environmental variables of the base user
        (root in this case).<br>
        <br>
      </div>
      <div> </div>
      <div>
        <div>Jon Adcock</div>
        <div>Network Systems Administrator</div>
        <div>MIS / Systems Team</div>
        <div>Leon County</div>
        <div>(850) 606-5500</div>
        >>> Alexander Haas <a class="moz-txt-link-rfc2396E" href="mailto:alex@geloet.de"><alex@geloet.de></a> 11/24/2010
        3:39 PM >>><br>
        Hi Nagios users,<br>
        <br>
        this is my first post. I encountered a behavior I am not able to
        <br>
        understand. Well, I guess I did understand it, but I don't know
        how to <br>
        counter it :)<br>
        <br>
        When I write a plug-in for Nagios it is executed as
        nagios:nagios. Yet <br>
        $HOME is set to "/root".<br>
        <br>
        My /etc/password and nagios's home-directory are ok. It works
        well when <br>
        I log in as user nagios and execute the plug-in there.<br>
        <br>
        I did expect to find some attributes for command definitions to
        set the <br>
        home directory, but I could not find any.<br>
        <br>
        I guess the whole thing has to do with su and the way it does
        (not) <br>
        handle the home directory or environment in general.<br>
        <br>
        Currently I work around that behavior using this code:<br>
        if [ "$HOME" == "/root" ] && [ "`whoami`" == "nagios" ]<br>
        then<br>
             HOME="/usr/local/nagios"<br>
        fi<br>
        <br>
        But as you might guess I am not very satisfied.<br>
        <br>
        Thanks in advance,<br>
        <br>
        Alex<br>
        <br>
------------------------------------------------------------------------------<br>
        Increase Visibility of Your 3D Game App & Earn a Chance To
        Win $500!<br>
        Tap into the largest installed PC base & get more eyes on
        your game by<br>
        optimizing for Intel(R) Graphics Technology. Get started today
        with the<br>
        Intel(R) Software Partner Program. Five $500 cash prizes are up
        for grabs.<br>
        <a moz-do-not-send="true"
          href="http://p.sf.net/sfu/intelisp-dev2dev">http://p.sf.net/sfu/intelisp-dev2dev</a><br>
        _______________________________________________<br>
        Nagios-users mailing list<br>
        <a class="moz-txt-link-abbreviated" href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</a><br>
        <a moz-do-not-send="true"
          href="https://lists.sourceforge.net/lists/listinfo/nagios-users">https://lists.sourceforge.net/lists/listinfo/nagios-users</a><br>
        ::: Please include Nagios version, plugin version (-v) and OS
        when reporting any issue. <br>
        ::: Messages without supporting info will risk being sent to
        /dev/null<br>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
------------------------------------------------------------------------------
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.
<a class="moz-txt-link-freetext" href="http://p.sf.net/sfu/intelisp-dev2dev">http://p.sf.net/sfu/intelisp-dev2dev</a></pre>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Nagios-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</a>
<a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/nagios-users">https://lists.sourceforge.net/lists/listinfo/nagios-users</a>
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null</pre>
    </blockquote>
    <br>
  </body>
</html>