Comment 2 for bug 30428

Revision history for this message
Dennis Kaarsemaker (dennis) wrote : Re: [Bug 30428] /var/lock/mrtg disappears on reboot

Confirmed. Simple patch (I'm not that fluent at perl):
 subscribe <email address hidden>

--- mrtg-2.12.2/bin/mrtg 2006-04-23 02:28:54.000000000 +0200
+++ mrtg-2.12.2.new/bin/mrtg 2006-04-23 02:28:29.000000000 +0200
@@ -1629,7 +1629,12 @@
                  " aged $lockage seconds is hanging around and I can't remove\n".
                  " it because another process is still using it.";
         }
-
+
+ # Create lockdir if it doesn't exist yet
+ my $lockdir = `dirname "$lockfile"`
+ if (!-e $lockdir) {
+ `mkdir -p "$lockdir"`
+ }
         open (LOCK, ">$lockfile") or
           die "ERROR: Creating lockfile $lockfile: $!\n";
         print LOCK "$$\n";