]> code.citadel.org Git - citadel.git/commitdiff
Alter the webcit shutdown a bit more.
authorDave West <davew@uncensored.citadel.org>
Tue, 15 Jan 2008 16:54:31 +0000 (16:54 +0000)
committerDave West <davew@uncensored.citadel.org>
Tue, 15 Jan 2008 16:54:31 +0000 (16:54 +0000)
Sending the watcher process a TERM kill the child and exits the watcher
without shutdown.
Sending the watcher a HUP shuts down cleanly.
Dothebart said this was the prefered way to do it.

webcit/webserver.c

index 4993a6d0e75a2eec3c4beb93440aaecd62676cb4..4d64727922ff6ba22af10220fd7271e66b8b03b5 100644 (file)
@@ -466,7 +466,8 @@ pid_t current_child;
 void graceful_shutdown_watcher(int signum) {
        lprintf (1, "bye; shutting down watcher.");
        kill(current_child, signum);
-//     exit(0);
+       if (signum != SIGHUP)
+               exit(0);
 }
 
 /**
@@ -541,14 +542,14 @@ void start_daemon(char *pid_file)
                        exit(errno);
                }
        
-               else if (current_child == 0) {
-                       signal(SIGTERM, graceful_shutdown);
+               else if (current_child == 0) {  // child process
+//                     signal(SIGTERM, graceful_shutdown);
                        signal(SIGHUP, graceful_shutdown);
 
                        return; /* continue starting webcit. */
                }
        
-               else {
+               else { // watcher process
 //                     signal(SIGTERM, SIG_IGN);
 //                     signal(SIGHUP, SIG_IGN);
                        if (pid_file) {