Antwort: Re: $HOME is not set in init script

Daniel Meyer eagle at cyberdelia.de
Fri Jan 26 08:45:14 CET 2007


On Thu, 25 Jan 2007, TKocher at spirit21.de wrote:

> Daniel,
> 
> nagios is started in /etc/init.d/nagios with "su - nagios -c nagios", so the process
> inherits the environment varialbes of the root user, which executes the su command.
> ($HOME is /root)

Which distribution are you using? My init-script (based on the one from 
Dag Wieers Nagios-RPM) starts nagios this way:

case "$1" in

         start)
                 echo "Starting network monitor: nagios"
                 $NagiosBin -v $NagiosCfgFile > /dev/null 2>&1;
                 if [ $? -eq 0 ]; then
                         su - $NagiosUser -c "/usr/bin/ndo2db -c 
/etc/nagios/ndo2db.cfg"
                         su - $NagiosUser -c "touch 
$NagiosVarDir/nagios.log $NagiosRetentionFile"
                         rm -f $NagiosCommandFile
                         touch $NagiosRunFile
                         chown $NagiosUser:$NagiosGroup $NagiosRunFile
                         $NagiosBin -d $NagiosCfgFile

Danny
-- 
Q: Gentoo is too hard to install      =        http://www.cyberdelia.de
    and I feel like whining.           =             eagle at cyberdelia.de
A: Please see /dev/null.              =
       (from the gentoo installer FAQ) =                             \o/

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
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