<div>Weird problem but I will do my best to explain it and the different scenarios I created to try to use it. Essentially my belief is nagios creates this file on startup with the wrong permissions and the file gets locked because I cannot even "tail" or "nano" the file. (vi does not work either)
</div>
<div> </div>
<div>System:</div>
<div> </div>
<div>Ubuntu Dapper LTS Server</div>
<div>Nagios 2.9</div>
<div> </div>
<div> </div>
<div>The nagios.cmd file cannot be written to and I always get the error through the nagios web interface as:</div>
<div><strong>--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
</strong></div>
<div>
<div class="errorMessage"><strong>Error: Could not open command file '/usr/local/nagios/var/rw/nagios.cmd' for update!</strong></div>
<p><strong></strong></p>
<p><strong></strong>
<div class="errorDescription"><strong>The permissions on the external command file and/or directory may be incorrect. Read the FAQs on how to setup proper permissions. </strong></div>
<p><strong></strong></p>
<p><strong></strong>
<div class="errorMessage"><strong>An error occurred while attempting to commit your command for processing.<br>--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
</strong></div>
<div class="errorMessage"> </div>
<div class="errorMessage">So I check the file permissions and I show:</div>
<div class="errorMessage"> </div>
<div class="errorMessage"><strong>--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
</strong></div>
<div class="errorMessage"><strong></strong> </div>
<div class="errorMessage"><strong><a href="mailto:root@maverick:/usr/local/nagios/var/rw">root@maverick:/usr/local/nagios/var/rw</a># ls -al<br>total 0<br>drwxrwsrwx 2 nagios nagios 80 2007-07-03 16:18 .<br>drwxrwxrwx 4 nagios nagios 384 2007-07-06 08:35 ..
<br>prwxrws--- 1 nagios nagios 0 2007-07-03 16:18 nagios.cmd<br><a href="mailto:root@maverick:/usr/local/nagios/var/rw">root@maverick:/usr/local/nagios/var/rw</a>#</strong></div>
<div class="errorMessage"><strong>--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
</strong></div>
<div class="errorMessage"><strong></strong> </div>
<div class="errorMessage">Those permissions are incorrect! Then to save ourselves any trouble I just change the permissions to 777 and worry about the consequences after I solve this problem.</div>
<div class="errorMessage"> </div>
<div class="errorMessage">Now I get this message issuing an external command:</div>
<div class="errorMessage">
<div class="errorMessage"><strong>--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
</strong></div></div>
<div class="errorMessage"><strong>Your command request was successfully submitted to Nagios for processing.<br><br>Note: It may take a while before the command is actually processed.</strong><br>
<div class="errorMessage"><strong><strong>--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
</strong></strong></div>
<div class="errorMessage"><strong></strong> </div>
<div class="errorMessage">Now to show you where I run into the actual trouble. I restarted nagios and it changed the permissions on the file.</div>
<div class="errorMessage"> </div>
<div class="errorMessage"><strong>--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
</strong></div>
<div class="errorMessage"><a href="mailto:root@maverick:/usr/local/nagios/var/rw"><strong>root@maverick:/usr/local/nagios/var/rw</strong></a><strong># ls -al<br>total 0<br>drwxrwsrwx 2 nagios nagios 80 2007-07-03 16:18 .
<br>drwxrwxrwx 4 nagios nagios 384 2007-07-06 08:40 ..<br>prwxrwxrwx 1 nagios nagios 0 2007-07-06 08:38 nagios.cmd<br></strong><a href="mailto:root@maverick:/usr/local/nagios/var/rw"><strong>root@maverick:/usr/local/nagios/var/rw
</strong></a><strong># /etc/init.d/nagios restart<br>Running configuration check...done<br>Stopping nagios: done.<br>Starting nagios: done.<br></strong><a href="mailto:root@maverick:/usr/local/nagios/var/rw"><strong>root@maverick:/usr/local/nagios/var/rw
</strong></a><strong># ls -al<br>total 0<br>drwxrwsrwx 2 nagios nagios 80 2007-07-06 08:40 .<br>drwxrwxrwx 4 nagios nagios 384 2007-07-06 08:40 ..<br>prw-rw---- 1 nagios nagios 0 2007-07-06 08:40 nagios.cmd<br></strong>
<a href="mailto:root@maverick:/usr/local/nagios/var/rw"><strong>root@maverick:/usr/local/nagios/var/rw</strong></a><strong>#</strong><br><strong>--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
</strong></div>
<div class="errorMessage"><strong></strong> </div>
<div class="errorMessage">The file permissions are incorrect and seemingly nagios caused the problem. Notice that the new file does not even have the same permissions as the file it created before.</div>
<div class="errorMessage"><strong></strong> </div></div></p></p></div>