]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
From: Markus Gyger <mgyger@itr.ch>
authorwessels <>
Wed, 25 Sep 1996 01:50:07 +0000 (01:50 +0000)
committerwessels <>
Wed, 25 Sep 1996 01:50:07 +0000 (01:50 +0000)
I've written a script for systems with SVR4 startup mechanism,
maybe it's useful for others too. However, I've tested it on
HP-UX 10.10 only, and there are some '?' where I don't know
what is used on those systems.

src/comm.cc
src/main.cc
src/tools.cc

index d01f054509a7824774c7269d9ba5e200e8f09b38..5e41b6bb44d5628d5d46ca743b98ccf0741295dc 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.cc,v 1.77 1996/09/20 20:27:33 wessels Exp $
+ * $Id: comm.cc,v 1.78 1996/09/24 19:50:07 wessels Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -670,7 +670,10 @@ comm_select(time_t sec)
            ftpServerClose();
            dnsShutdownServers();
            redirectShutdownServers();
-           setSocketShutdownLifetimes();
+           if (shutdown_pending > 0)
+               setSocketShutdownLifetimes(Config.lifetimeShutdown);
+           else
+               setSocketShutdownLifetimes(0);
        }
        nfds = 0;
        maxfd = fdstat_biggest_fd() + 1;
index 3ef32947aef57dc494573aae7dc13b7bc934c93b..61268f187fe6f34f5576301473cab0662d1bfa61 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: main.cc,v 1.85 1996/09/20 23:26:57 wessels Exp $
+ * $Id: main.cc,v 1.86 1996/09/24 19:50:08 wessels Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -167,7 +167,7 @@ Usage: %s [-hsvzCDFRUVY] [-f config-file] [-[au] port] [-k signal]\n\
                  %s\n\
        -h        Print help message.\n\
        -i        Disable IP caching.\n\
-       -k reconfigure|rotate|shutdown|kill|debug|check\n\
+       -k reconfigure|rotate|shutdown|interrupt|kill|debug|check\n\
                 Send signal to running copy and exit.\n\
        -s        Enable logging to syslog.\n\
        -u port   Specify ICP port number (default: %d), disable with 0.\n\
@@ -240,6 +240,8 @@ mainParseOptions(int argc, char *argv[])
                opt_send_signal = SIGUSR2;
            else if (!strncmp(optarg, "shutdown", strlen(optarg)))
                opt_send_signal = SIGTERM;
+            else if (!strncmp(optarg, "interrupt", strlen(optarg)))
+                opt_send_signal = SIGINT;
            else if (!strncmp(optarg, "kill", strlen(optarg)))
                opt_send_signal = SIGKILL;
            else if (!strncmp(optarg, "check", strlen(optarg)))
@@ -303,11 +305,11 @@ reconfigure(int sig)
 void
 shut_down(int sig)
 {
+    shutdown_pending = sig == SIGINT ? -1 : 1;
     debug(21, 1, "Preparing for shutdown after %d connections\n",
        ntcpconn + nudpconn);
     debug(21, 1, "Waiting %d seconds for active connections to finish\n",
-       Config.lifetimeShutdown);
-    shutdown_pending = 1;
+       shutdown_pending > 0 ? Config.lifetimeShutdown : 0);
 #if SA_RESETHAND == 0
     signal(SIGTERM, SIG_DFL);
     signal(SIGINT, SIG_DFL);
index af2e6b78506cad8d6d3d752c9ea831ecdbbad30a..78b4bf395d3debec5834d8d575ca4c7beb109e14 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.63 1996/09/20 23:27:01 wessels Exp $
+ * $Id: tools.cc,v 1.64 1996/09/24 19:50:10 wessels Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -263,10 +263,9 @@ sigusr2_handle(int sig)
 }
 
 void
-setSocketShutdownLifetimes(void)
+setSocketShutdownLifetimes(int lft)
 {
     FD_ENTRY *f = NULL;
-    int lft = Config.lifetimeShutdown;
     int cur;
     int i;
     for (i = fdstat_biggest_fd(); i >= 0; i--) {