]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Mark Nottingham <mnot@pobox.com>
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 1 Mar 2009 03:25:23 +0000 (16:25 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 1 Mar 2009 03:25:23 +0000 (16:25 +1300)
Bug 2599: Idempotent start

As discussed on squid-dev, Squid shouldn't return a shell error when:
  - starting squid, if it's already running
  - stopping squid, if it isn't running
This is to make writing scripts that control squid easier.

Note that it should still notify the user, and should not affect other
operations (e.g., kill, rotate, parse).

src/main.cc

index ea43f2fec868e02773f7d8dfbe5c595909513c90..92f00ee304e95e2676b1a3632f964373457726f7 100644 (file)
@@ -1240,7 +1240,7 @@ SquidMain(int argc, char **argv)
     setUmask(Config.umask);
     if (-1 == opt_send_signal)
         if (checkRunningPid())
-            exit(1);
+            exit(0);
 
 #if TEST_ACCESS
 
@@ -1396,8 +1396,13 @@ sendSignal(void)
             exit(1);
         }
     } else {
-        fprintf(stderr, "%s: ERROR: No running copy\n", APP_SHORTNAME);
-        exit(1);
+        if (opt_send_signal != SIGTERM) {
+            fprintf(stderr, "%s: ERROR: No running copy\n", APP_SHORTNAME);
+            exit(1);
+        } else {
+            fprintf(stderr, "%s: No running copy\n", APP_SHORTNAME);
+            exit(0);
+        }
     }
 
     /* signal successfully sent */