<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:#404040;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Vorformatiert Zchn";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.HTMLVorformatiertZchn
        {mso-style-name:"HTML Vorformatiert Zchn";
        mso-style-priority:99;
        mso-style-link:"HTML Vorformatiert";
        font-family:Consolas;
        color:black;}
span.E-MailFormatvorlage19
        {mso-style-type:personal;
        font-family:"Courier New";
        color:#404040;
        font-weight:normal;
        font-style:normal;}
span.E-MailFormatvorlage20
        {mso-style-type:personal-reply;
        font-family:"Courier New";
        color:#365F91;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body bgcolor=white lang=DE-CH link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='color:#365F91'>Hi Francois<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#365F91'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='color:#365F91'>It’s very helpful… <o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#365F91'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='color:#365F91'>Merci beaucoup<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#365F91'>Jérôme<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#365F91'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='color:#365F91'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='color:#365F91'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='color:#365F91'><o:p> </o:p></span></p>

<div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal><b><span lang=DE style='font-family:"Tahoma","sans-serif";
color:windowtext'>Von:</span></b><span lang=DE style='font-family:"Tahoma","sans-serif";
color:windowtext'> Network Operation Center FMC Luxemburg
[mailto:NOC@eurofmc.com] <br>
<b>Gesendet:</b> Dienstag, 5. Mai 2009 10:14<br>
<b>An:</b> Meyer Jerome<br>
<b>Cc:</b> Nagios-users@lists.sourceforge.net<br>
<b>Betreff:</b> Re: [Nagios-users] How to stop nagios properly?<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>Hi Jerome,<br>
<br>
See the script below . Is that we use in production:<br>
<br>
François<br>
FMC Luxembourg SA Luxembourg<br>
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<o:p></o:p></p>

<div><pre>#!/bin/sh<o:p></o:p></pre><pre># <o:p></o:p></pre><pre># chkconfig: 345 99 01<o:p></o:p></pre><pre># description: Nagios network monitor<o:p></o:p></pre><pre>#<o:p></o:p></pre><pre># File : nagios<o:p></o:p></pre><pre>#<o:p></o:p></pre><pre># Author : Jorge Sanchez Aymar (<a
href="mailto:jsanchez@lanchile.cl">jsanchez@lanchile.cl</a>)<o:p></o:p></pre><pre># <o:p></o:p></pre><pre># Changelog :<o:p></o:p></pre><pre>#<o:p></o:p></pre><pre># 1999-07-09 Karl DeBisschop <a
href="mailto:kdebisschop@infoplease.com"><kdebisschop@infoplease.com></a><o:p></o:p></pre><pre>#  - setup for autoconf<o:p></o:p></pre><pre>#  - add reload function<o:p></o:p></pre><pre># 1999-08-06 Ethan Galstad <a
href="mailto:egalstad@nagios.org"><egalstad@nagios.org></a><o:p></o:p></pre><pre>#  - Added configuration info for use with RedHat's chkconfig tool<o:p></o:p></pre><pre>#    per Fran Boon's suggestion<o:p></o:p></pre><pre># 1999-08-13 Jim Popovitch <a
href="mailto:jimpop@rocketship.com"><jimpop@rocketship.com></a><o:p></o:p></pre><pre>#  - added variable for nagios/var directory<o:p></o:p></pre><pre>#  - cd into nagios/var directory before creating tmp files on startup<o:p></o:p></pre><pre># 1999-08-16 Ethan Galstad <a
href="mailto:egalstad@nagios.org"><egalstad@nagios.org></a><o:p></o:p></pre><pre>#  - Added test for rc.d directory as suggested by Karl DeBisschop<o:p></o:p></pre><pre># 2000-07-23 Karl DeBisschop <a
href="mailto:kdebisschop@users.sourceforge.net"><kdebisschop@users.sourceforge.net></a><o:p></o:p></pre><pre>#  - Clean out redhat macros and other dependencies<o:p></o:p></pre><pre># 2003-01-11 Ethan Galstad <a
href="mailto:egalstad@nagios.org"><egalstad@nagios.org></a><o:p></o:p></pre><pre>#  - Updated su syntax (Gary Miller)<o:p></o:p></pre><pre>#<o:p></o:p></pre><pre># Description: Starts and stops the Nagios monitor<o:p></o:p></pre><pre>#              used to provide network services status.<o:p></o:p></pre><pre>#<o:p></o:p></pre><pre>  <o:p></o:p></pre><pre>status_nagios ()<o:p></o:p></pre><pre>{<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       if test -x $NagiosCGI/daemonchk.cgi; then<o:p></o:p></pre><pre>              if $NagiosCGI/daemonchk.cgi -l $NagiosRunFile; then<o:p></o:p></pre><pre>                      return 0<o:p></o:p></pre><pre>              else<o:p></o:p></pre><pre>                      return 1<o:p></o:p></pre><pre>              fi<o:p></o:p></pre><pre>       else<o:p></o:p></pre><pre>              if ps -p $NagiosPID > /dev/null 2>&1; then<o:p></o:p></pre><pre>                      return 0<o:p></o:p></pre><pre>              else<o:p></o:p></pre><pre>                      return 1<o:p></o:p></pre><pre>              fi<o:p></o:p></pre><pre>       fi<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       return 1<o:p></o:p></pre><pre>}<o:p></o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre>printstatus_nagios()<o:p></o:p></pre><pre>{<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       if status_nagios $1 $2; then<o:p></o:p></pre><pre>              echo "nagios (pid $NagiosPID) is running..."<o:p></o:p></pre><pre>       else<o:p></o:p></pre><pre>              echo "nagios is not running"<o:p></o:p></pre><pre>       fi<o:p></o:p></pre><pre>}<o:p></o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre>killproc_nagios ()<o:p></o:p></pre><pre>{<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       kill $2 $NagiosPID<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>}<o:p></o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre>pid_nagios ()<o:p></o:p></pre><pre>{<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       if test ! -f $NagiosRunFile; then<o:p></o:p></pre><pre>              echo "No lock file found in $NagiosRunFile"<o:p></o:p></pre><pre>              exit 1<o:p></o:p></pre><pre>       fi<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       NagiosPID=`head -n 1 $NagiosRunFile`<o:p></o:p></pre><pre>}<o:p></o:p></pre><pre><o:p> </o:p></pre><pre><o:p> </o:p></pre><pre># Source function library<o:p></o:p></pre><pre># Solaris doesn't have an rc.d directory, so do a test first<o:p></o:p></pre><pre>if [ -f /etc/rc.d/init.d/functions ]; then<o:p></o:p></pre><pre>       . /etc/rc.d/init.d/functions<o:p></o:p></pre><pre>elif [ -f /etc/init.d/functions ]; then<o:p></o:p></pre><pre>       . /etc/init.d/functions<o:p></o:p></pre><pre>fi<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>prefix=/usr/local/nagios<o:p></o:p></pre><pre>exec_prefix=${prefix}<o:p></o:p></pre><pre>NagiosBin=${exec_prefix}/bin/nagios<o:p></o:p></pre><pre>NagiosCfgFile=/etc/nagios/nagios.cfg<o:p></o:p></pre><pre>NagiosStatusFile=${prefix}/var/status.dat<o:p></o:p></pre><pre>NagiosRetentionFile=${prefix}/var/retention.dat<o:p></o:p></pre><pre>NagiosCommandFile=${prefix}/var/rw/nagios.cmd<o:p></o:p></pre><pre>NagiosVarDir=${prefix}/var<o:p></o:p></pre><pre>NagiosRunFile=${prefix}/var/nagios.lock<o:p></o:p></pre><pre>NagiosLockDir=/var/lock/subsys<o:p></o:p></pre><pre>NagiosLockFile=nagios<o:p></o:p></pre><pre>NagiosCGIDir=${exec_prefix}/sbin<o:p></o:p></pre><pre>NagiosUser=nagios<o:p></o:p></pre><pre>NagiosGroup=nagios<o:p></o:p></pre><pre>          <o:p></o:p></pre><pre><o:p> </o:p></pre><pre># Check that nagios exists.<o:p></o:p></pre><pre>if [ ! -f $NagiosBin ]; then<o:p></o:p></pre><pre>    echo "Executable file $NagiosBin not found.  Exiting."<o:p></o:p></pre><pre>    exit 1<o:p></o:p></pre><pre>fi<o:p></o:p></pre><pre><o:p> </o:p></pre><pre># Check that nagios.cfg exists.<o:p></o:p></pre><pre>if [ ! -f $NagiosCfgFile ]; then<o:p></o:p></pre><pre>    echo "Configuration file $NagiosCfgFile not found.  Exiting."<o:p></o:p></pre><pre>    exit 1<o:p></o:p></pre><pre>fi<o:p></o:p></pre><pre>          <o:p></o:p></pre><pre># See how we were called.<o:p></o:p></pre><pre>case "$1" in<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       start)<o:p></o:p></pre><pre>              echo -n "Starting nagios:"<o:p></o:p></pre><pre>              $NagiosBin -v $NagiosCfgFile > /dev/null 2>&1;<o:p></o:p></pre><pre>              if [ $? -eq 0 ]; then<o:p></o:p></pre><pre>                      su - $NagiosUser -c "touch $NagiosVarDir/nagios.log $NagiosRetentionFile"<o:p></o:p></pre><pre>                      rm -f $NagiosCommandFile<o:p></o:p></pre><pre>                      touch $NagiosRunFile<o:p></o:p></pre><pre>                      chown $NagiosUser:$NagiosGroup $NagiosRunFile<o:p></o:p></pre><pre>                      $NagiosBin -d $NagiosCfgFile<o:p></o:p></pre><pre>                      if [ -d $NagiosLockDir ]; then touch $NagiosLockDir/$NagiosLockFile; fi<o:p></o:p></pre><pre>                      echo " done."<o:p></o:p></pre><pre>                      exit 0<o:p></o:p></pre><pre>              else<o:p></o:p></pre><pre>                      echo "CONFIG ERROR!  Start aborted.  Check your Nagios configuration."<o:p></o:p></pre><pre>                      exit 1<o:p></o:p></pre><pre>              fi<o:p></o:p></pre><pre>              ;;<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       stop)<o:p></o:p></pre><pre>              echo -n "Stopping nagios: "<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>              pid_nagios<o:p></o:p></pre><pre>              killproc_nagios nagios<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>              # now we have to wait for nagios to exit and remove its<o:p></o:p></pre><pre>              # own NagiosRunFile, otherwise a following "start" could<o:p></o:p></pre><pre>              # happen, and then the exiting nagios will remove the<o:p></o:p></pre><pre>              # new NagiosRunFile, allowing multiple nagios daemons<o:p></o:p></pre><pre>              # to (sooner or later) run - John Sellens<o:p></o:p></pre><pre>              #echo -n 'Waiting for nagios to exit .'<o:p></o:p></pre><pre>              for i in 1 2 3 4 5 6 7 8 9 10 ; do<o:p></o:p></pre><pre>                  if status_nagios > /dev/null; then<o:p></o:p></pre><pre>                      echo -n '.'<o:p></o:p></pre><pre>                      sleep 1<o:p></o:p></pre><pre>                  else<o:p></o:p></pre><pre>                      break<o:p></o:p></pre><pre>                  fi<o:p></o:p></pre><pre>              done<o:p></o:p></pre><pre>              if status_nagios > /dev/null; then<o:p></o:p></pre><pre>                  echo ''<o:p></o:p></pre><pre>                  echo 'Warning - nagios did not exit in a timely manner'<o:p></o:p></pre><pre>              else<o:p></o:p></pre><pre>                  echo 'done.'<o:p></o:p></pre><pre>              fi<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>              rm -f $NagiosStatusFile $NagiosRunFile $NagiosLockDir/$NagiosLockFile $NagiosCommandFile<o:p></o:p></pre><pre>              ;;<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       status)<o:p></o:p></pre><pre>              pid_nagios<o:p></o:p></pre><pre>              printstatus_nagios nagios<o:p></o:p></pre><pre>              ;;<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       checkconfig)<o:p></o:p></pre><pre>              printf "Running configuration check..."<o:p></o:p></pre><pre>              $NagiosBin -v $NagiosCfgFile > /dev/null 2>&1;<o:p></o:p></pre><pre>              if [ $? -eq 0 ]; then<o:p></o:p></pre><pre>                      echo " OK."<o:p></o:p></pre><pre>              else<o:p></o:p></pre><pre>                      echo " CONFIG ERROR!  Check your Nagios configuration."<o:p></o:p></pre><pre>                      exit 1<o:p></o:p></pre><pre>              fi<o:p></o:p></pre><pre>              ;;<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       restart)<o:p></o:p></pre><pre>              printf "Running configuration check..."<o:p></o:p></pre><pre>              $NagiosBin -v $NagiosCfgFile > /dev/null 2>&1;<o:p></o:p></pre><pre>              if [ $? -eq 0 ]; then<o:p></o:p></pre><pre>                      echo "done."<o:p></o:p></pre><pre>                      $0 stop<o:p></o:p></pre><pre>                      $0 start<o:p></o:p></pre><pre>              else<o:p></o:p></pre><pre>                      echo " CONFIG ERROR!  Restart aborted.  Check your Nagios configuration."<o:p></o:p></pre><pre>                      exit 1<o:p></o:p></pre><pre>              fi<o:p></o:p></pre><pre>              ;;<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       reload|force-reload)<o:p></o:p></pre><pre>              printf "Running configuration check..."<o:p></o:p></pre><pre>              $NagiosBin -v $NagiosCfgFile > /dev/null 2>&1;<o:p></o:p></pre><pre>              if [ $? -eq 0 ]; then<o:p></o:p></pre><pre>                      echo "done."<o:p></o:p></pre><pre>                      if test ! -f $NagiosRunFile; then<o:p></o:p></pre><pre>                              $0 start<o:p></o:p></pre><pre>                      else<o:p></o:p></pre><pre>                              pid_nagios<o:p></o:p></pre><pre>                              if status_nagios > /dev/null; then<o:p></o:p></pre><pre>                                     printf "Reloading nagios configuration..."<o:p></o:p></pre><pre>                                     killproc_nagios nagios -HUP<o:p></o:p></pre><pre>                                     echo "done"<o:p></o:p></pre><pre>                              else<o:p></o:p></pre><pre>                                     $0 stop<o:p></o:p></pre><pre>                                     $0 start<o:p></o:p></pre><pre>                              fi<o:p></o:p></pre><pre>                      fi<o:p></o:p></pre><pre>              else<o:p></o:p></pre><pre>                      echo " CONFIG ERROR!  Reload aborted.  Check your Nagios configuration."<o:p></o:p></pre><pre>                      exit 1<o:p></o:p></pre><pre>              fi<o:p></o:p></pre><pre>              ;;<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>       *)<o:p></o:p></pre><pre>              echo "Usage: nagios {start|stop|restart|reload|force-reload|status|checkconfig}"<o:p></o:p></pre><pre>              exit 1<o:p></o:p></pre><pre>              ;;<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>esac<o:p></o:p></pre><pre>  <o:p></o:p></pre><pre># End of this script<o:p></o:p></pre></div>

<p class=MsoNormal><br>
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br>
<br>
Meyer Jerome wrote: <o:p></o:p></p>

<p class=MsoNormal>Hi<o:p></o:p></p>

<p class=MsoNormal><span style='font-size:9.0pt'> </span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:9.0pt'>I used with RedHat
„service nagios stop/start“ to manage the nagios server but
I’ll see that the stop is not enough because one process is running :</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:9.0pt'> </span><o:p></o:p></p>

<p class=MsoNormal><span lang=FR style='font-size:9.0pt'>ps -ef|grep nagios</span><o:p></o:p></p>

<p class=MsoNormal><span lang=FR style='font-size:9.0pt'>root    
16729 16670  0 09:21 pts/1    00:00:00 grep nagios</span><o:p></o:p></p>

<p class=MsoNormal><span lang=FR style='font-size:9.0pt'>nagios  
27223     1  0 Apr24
?        00:02:10 /usr/local/nagios/bin/nagios
-d /etc/nagios/nagios.cfg</span><o:p></o:p></p>

<p class=MsoNormal><span lang=FR style='font-size:9.0pt'> </span><o:p></o:p></p>

<p class=MsoNormal><span lang=FR style='font-size:9.0pt'>Which command to use
to stop nagios properly??</span><o:p></o:p></p>

<p class=MsoNormal><span lang=FR style='font-size:9.0pt'> </span><o:p></o:p></p>

<p class=MsoNormal><span lang=FR style='font-size:9.0pt'> </span><o:p></o:p></p>

<p class=MsoNormal><span lang=FR style='font-size:9.0pt'> </span><o:p></o:p></p>

<p class=MsoNormal><span lang=FR style='font-size:9.0pt'>Thanks in advance</span><o:p></o:p></p>

<p class=MsoNormal><span lang=FR style='font-size:9.0pt'>Jérôme Meyer</span><o:p></o:p></p>

<pre><o:p> </o:p></pre><pre style='text-align:center'>

<hr size=4 width="90%" align=center>

</pre><pre><o:p> </o:p></pre><pre>------------------------------------------------------------------------------<o:p></o:p></pre><pre>The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your<o:p></o:p></pre><pre>production scanning environment may not be a perfect world - but thanks to<o:p></o:p></pre><pre>Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700<o:p></o:p></pre><pre>Series Scanner you'll get full speed at 300 dpi even with all image <o:p></o:p></pre><pre>processing features enabled. <a
href="http://p.sf.net/sfu/kodak-com">http://p.sf.net/sfu/kodak-com</a><o:p></o:p></pre><pre><o:p> </o:p></pre><pre
style='text-align:center'>

<hr size=4 width="90%" align=center>

</pre><pre><o:p> </o:p></pre><pre>_______________________________________________<o:p></o:p></pre><pre>Nagios-users mailing list<o:p></o:p></pre><pre><a
href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</a><o:p></o:p></pre><pre><a
href="https://lists.sourceforge.net/lists/listinfo/nagios-users">https://lists.sourceforge.net/lists/listinfo/nagios-users</a><o:p></o:p></pre><pre>::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. <o:p></o:p></pre><pre>::: Messages without supporting info will risk being sent to /dev/null<o:p></o:p></pre>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif";
color:black'><o:p> </o:p></span></p>

</div>

</div>

</body>

</html>