]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Delay unlinking of the pid file to after where the services of Squid have
authorhno <>
Sat, 1 Feb 2003 20:36:09 +0000 (20:36 +0000)
committerhno <>
Sat, 1 Feb 2003 20:36:09 +0000 (20:36 +0000)
shut down and the swap has been flushed.

This allows scripts to use "squid -k check" to determine if/when Squid has
shut down.

In the long run we should probably extend "squid -k shutdown" with such
check to ensure clean shutdowns.

src/main.cc

index 8ded205db0e0f45ce11abdccd16548108434e2f4..84f4b62b412f112e1d615a259aa64b71dada22d1 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: main.cc,v 1.362 2003/01/23 00:37:23 robertc Exp $
+ * $Id: main.cc,v 1.363 2003/02/01 13:36:09 hno Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -935,11 +935,6 @@ static void
 SquidShutdown(void *unused)
 {
     debug(1, 1) ("Shutting down...\n");
-    if (Config.pidFilename && strcmp(Config.pidFilename, "none")) {
-       enter_suid();
-       safeunlink(Config.pidFilename, 0);
-       leave_suid();
-    }
     icpConnectionClose();
 #if USE_HTCP
     htcpSocketClose();
@@ -1002,6 +997,11 @@ SquidShutdown(void *unused)
 #if MEM_GEN_TRACE
     log_trace_done();
 #endif
+    if (Config.pidFilename && strcmp(Config.pidFilename, "none") != 0) {
+       enter_suid();
+       safeunlink(Config.pidFilename, 0);
+       leave_suid();
+    }
     debug(1, 1) ("Squid Cache (Version %s): Exiting normally.\n",
        version_string);
     if (debug_log)