[Pkg-nagios-devel] Bug#361239: nagios2 cannot start, if /var is on a tempfs

Herbert Straub herbert at linuxhacker.at
Fri Apr 7 10:54:08 UTC 2006


Package: nagios2
Version: 2.0-1

The process nagios2 cannot be started, if the /var directory is on a  
tempfs, because the directory /var/run/nagios2 doesn't exists. This  
directory will be created in the nagios2-common.postinst script. After  
a reboot, the directory doesn't exists anymore. A second aspect is the  
hardcoded path in the postinst script:

install -d -onagios -gnagios -m750 /var/run/nagios2

and the startup script will create the path dynamically from the  
lock_file statement in the Nagios configuration file:
THEPIDFILE="$(grep lock_file $NAGIOSCFG | awk '{print $2}' FS="=")"
After a change of the lock_file statement, the nagios process cannot  
start anymor.

This patch will correct this phenomenon:
diff -u nagios2.ORIG  nagios2
--- nagios2.ORIG        2006-04-07 12:10:37.000000000 +0200
+++ nagios2     2006-04-07 12:35:51.000000000 +0200
@@ -96,6 +96,10 @@
  [ "$PID" = '1' ] && unset PID

  start () {
+  # /var/run and /var/lock could be on a tmpfs
+  DIRECTORY=`echo $THEPIDFILE | sed 's!/[^/]\+$!!'`
+  [ ! -d $DIRECTORY ] && mkdir $DIRECTORY
+  chown nagios:nagios $DIRECTORY
    if ! check_started; then
      if ! check_named_pipe; then
        log_action_msg "named pipe exists - removing"


Best regards
Herbert Straub




More information about the Pkg-nagios-devel mailing list