]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Mark Nottingham <mnot@pobox.com>
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 10 Apr 2009 07:15:05 +0000 (19:15 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 10 Apr 2009 07:15:05 +0000 (19:15 +1200)
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 aa44bb672e5aef1e46d7d9ca863d55b5dd8f05d8..9ec53c4d27e6c5ee13446d03608edd35359412fa 100644 (file)
@@ -1218,7 +1218,7 @@ main(int argc, char **argv)
     setUmask(Config.umask);
     if (-1 == opt_send_signal)
         if (checkRunningPid())
-            exit(1);
+            exit(0);
 
 #if TEST_ACCESS
 
@@ -1384,8 +1384,13 @@ sendSignal(void)
             exit(1);
         }
     } else {
-        fprintf(stderr, "%s: ERROR: No running copy\n", appname);
-        exit(1);
+        if (opt_send_signal != SIGTERM) {
+            fprintf(stderr, "%s: ERROR: No running copy\n", appname);
+            exit(1);
+        } else {
+            fprintf(stderr, "%s: No running copy\n", appname);
+            exit(0);
+        }
     }
 
     /* signal successfully sent */