From: wessels <> Date: Wed, 25 Sep 1996 01:50:07 +0000 (+0000) Subject: From: Markus Gyger X-Git-Tag: SQUID_3_0_PRE1~5733 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f3753518a021fc0db76191754a3f62a5580f9dc5;p=thirdparty%2Fsquid.git From: Markus Gyger 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. --- diff --git a/src/comm.cc b/src/comm.cc index d01f054509..5e41b6bb44 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -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; diff --git a/src/main.cc b/src/main.cc index 3ef32947ae..61268f187f 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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); diff --git a/src/tools.cc b/src/tools.cc index af2e6b7850..78b4bf395d 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -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--) {