* enable the watcher do differenciate between crash & regular exit, so he can send...
authorWilfried Göesgens <willi@citadel.org>
Mon, 6 Apr 2009 12:14:42 +0000 (12:14 +0000)
committerWilfried Göesgens <willi@citadel.org>
Mon, 6 Apr 2009 12:14:42 +0000 (12:14 +0000)
citadel/citserver.c
citadel/server.h
citadel/sysdep.c

index 94a5894f3942aaf35a4e17a1f1d5e691bc98be80..4e65fd6da1cbaf51b376e3c477f1c41f1eee530e 100644 (file)
@@ -228,6 +228,8 @@ void master_cleanup(int exitcode) {
        
        if (restart_server != 0)
                exit(1);
+       if ((running_as_daemon != 0) && (exitcode == 0))
+               exitcode = CTDLEXIT_SHUTDOWN;
        exit(exitcode);
 }
 
index 577494ed5dcb3fd130d96cb754cc03237564f9ec..f9240227751fc78e682462a73f088f45eab7821c 100644 (file)
@@ -43,6 +43,9 @@ struct CtdlMessage {
 #define CTDLEXIT_OOD           104     /* Out Of Date config - rerun setup */
 #define CTDLEXIT_DB            105     /* Unable to initialize database */
 #define CTDLEXIT_LIBCITADEL    106     /* Incorrect version of libcitadel */
+#define CTDLEXIT_SHUTDOWN      150     /* we're going down. watcher don't 
+                                        * fire us up again. 
+                                        */
 
 
 
index 46bdf021a405abb4d2568a674a868714cd9e8f36..4cd22d0d5ca637463b7892c23aae916fc7147156 100644 (file)
@@ -964,7 +964,7 @@ void start_daemon(int unused) {
                if (WIFEXITED(status)) {
 
                        /* Exit code 0 means the watcher should exit */
-                       if (WEXITSTATUS(status) == 0) {
+                       if (WEXITSTATUS(status) == CTDLEXIT_SHUTDOWN) {
                                do_restart = 0;
                        }