<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">


<meta name=Generator content="Microsoft Word 10 (filtered)">

<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";
        color:black;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
pre
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.EmailStyle18
        {color:black;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body bgcolor=white lang=EN-US link=blue vlink=blue>

<div class=Section1>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>/etc/init.d/nagios stop</span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>sleep 30</span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>ps –ef|grep nagios</span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>echo “now stopping sendmail”</span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>/etc/init.d/sendmail restart</span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>sleep 30</span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>echo “now calling named”</span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>/etc/init.d/named</span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>echo “now starting nagios”</span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>/etc/init.d/nagios start</span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>This should give you a pretty good idea as to where
the script is failing, based on what echo statements get processed. If you’re
not running the script interactively then redirect the output to a log, i.e.,
/usr/local/nagios/bin/mynagios_script > /usr/local/nagios/tmp/mynagios_script.log.
These are basic script debugging techniques. You may do well getting yourself a
good shell scripting reference guide.</span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>Todd</span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=black
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;color:windowtext'>-----Original
Message-----<br>
<b><span style='font-weight:bold'>From:</span></b>
nagios-users-admin@lists.sourceforge.net
[mailto:nagios-users-admin@lists.sourceforge.net] <b><span style='font-weight:
bold'>On Behalf Of </span></b>enrico fanti<br>
<b><span style='font-weight:bold'>Sent:</span></b> Friday, November 18, 2005
8:19 AM<br>
<b><span style='font-weight:bold'>To:</span></b> Todd Barbera<br>
<b><span style='font-weight:bold'>Cc:</span></b>
nagios-users@lists.sourceforge.net<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [Nagios-users] Nagios
father, script son ??</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=3 color=black
face="Times New Roman"><span style='font-size:12.0pt'> </span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=3 color=black
face="Times New Roman"><span style='font-size:12.0pt'>Hi Todd,<br>
<br>
I tried your hint, but isn't ok.<br>
<br>
Wath do you mean with "you could put in a process grep in the script"
?<br>
<br>
Thank you<br>
<br>
Enrico<br>
<br>
<br>
Todd Barbera wrote: </span></font></p>

<pre style='margin-left:.5in' wrap=""><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt'>Hi Enrico,</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>Try putting in the following:</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>/etc/init.d/nagios stop</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>sleep 30</span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>echo "now to stop sendmail"</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>/etc/init.d/sendmail restart</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>sleep 30</span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>echo "now to call named"</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>/etc/init.d/named</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>This will help determine if the script is truly dying because the nagios</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>process stops. 30 seconds should be far more time needed for nagios to</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>shutdown, although I suppose you could put in a process grep in the script</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>to verify.</span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'> </span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>Todd</span></font></pre><pre style='margin-left:.5in'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'> </span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>----- Original Message ----- </span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>From: "enrico fanti" <a
href="mailto:e.fanti@pointercom.it"><e.fanti@pointercom.it></a></span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>To: <a href="mailto:jpratt@norwich.edu"><jpratt@norwich.edu></a>; <a
href="mailto:nagios-users@lists.sourceforge.net"><nagios-users@lists.sourceforge.net></a></span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>Sent: Friday, November 18, 2005 7:18 AM</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>Subject: Re: [Nagios-users] Nagios father, script son ??</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'> </span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>  </span></font></pre>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt' type=cite><pre
style='margin-left:.5in' wrap=""><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>Hi,</span></font></pre><pre style='margin-left:.5in'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>I tried that but it doesn't work..</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>It seems to be very stange case...</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'> </span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'> </span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>Jamie Pratt wrote:</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>    </span></font></pre>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt' type=cite><pre
style='margin-left:.5in' wrap=""><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>did you try tagging an & on the end of the command line to fork it off</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>into the background? sometimes this will help..</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>regards,</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>jamie</span></font></pre><pre style='margin-left:.5in'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'> </span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>-- </span></font></pre><pre style='margin-left:.5in'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'> </span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>James Pratt</span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>Unix Systems Administrator</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>Norwich University - Information Technology</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><a href="mailto:jpratt@norwich.edu">jpratt@norwich.edu</a> | 1-802-485-2532</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'> </span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>enrico fanti wrote:</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>      </span></font></pre>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt' type=cite><pre
style='margin-left:.5in' wrap=""><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>Hi to all</span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'> </span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>I have this problem</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>Nagios executes a script.</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>This script have to restart the Nagios process in this way:</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>/etc/init.d/nagios stop</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>/etc/init.d/sendmail restart</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>/etc/init.d/named</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>/etc/init.d/nagios start</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>The problem is that when the script execute this sequence, it</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>executes only:</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>/etc/init.d/nagios stop</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>/etc/init.d/sendmail stop</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>It seems that the father Nagios execute the son script, but this</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>script dies when the father dies (Nagios).</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'> </span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>Is there a way to run the son script separately from the father</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>Thak you</span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'> </span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>Enrico</span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'> </span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>        </span></font></pre></blockquote>

<pre style='margin-left:.5in' wrap=""><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt'> </span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>      </span></font></pre></blockquote>

<pre style='margin-left:.5in' wrap=""><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt'>-- </span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>=======================================</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>Enrico Fanti</span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>PointerCom s.p.a - <a
href="http://www.pointercom.it">http://www.pointercom.it</a></span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>Via Francesco De Sanctis, 9</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>00195 Roma - ITALY</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>tel. +39-06-37591259</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>fax +39-06-37591202</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><a href="mailto:e.fanti@pointercom.it">e.fanti@pointercom.it</a></span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>================================</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'> </span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'> </span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>    </span></font></pre></blockquote>

<pre style='margin-left:.5in' wrap=""><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt'> </span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'> </span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>  </span></font></pre>

<p class=MsoNormal style='margin-left:.5in'><font size=3 color=black
face="Times New Roman"><span style='font-size:12.0pt'><br>
<br>
</span></font></p>

<pre style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>-- </span></font></pre><pre style='margin-left:.5in'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>=======================================</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>Enrico Fanti</span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>PointerCom s.p.a - <a
href="http://www.pointercom.it">http://www.pointercom.it</a></span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>Via Francesco De Sanctis, 9</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>00195 Roma - ITALY</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>tel. +39-06-37591259</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>fax +39-06-37591202</span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><a href="mailto:e.fanti@pointercom.it">e.fanti@pointercom.it</a></span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>================================ </span></font></pre><pre
style='margin-left:.5in'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
.5in'><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'> </span></font></pre></div>

</body>

</html>