]> git.wh0rd.org Git - tt-rss.git/commitdiff
daemon: better shutdown/sigint reporting
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 25 Feb 2013 17:36:18 +0000 (21:36 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 25 Feb 2013 17:36:18 +0000 (21:36 +0400)
update_daemon2.php

index 8b19558181cf53006a4d792549b69e716f29d00a..4a6001b3f3b0299252a53dbcfa6fad21ca1763b2 100755 (executable)
        }
 
        function shutdown() {
-               if (file_exists(LOCK_DIRECTORY . "/update_daemon.lock"))
+               if (file_exists(LOCK_DIRECTORY . "/update_daemon.lock")) {
+                       _debug("removing lockfile (master)...");
                        unlink(LOCK_DIRECTORY . "/update_daemon.lock");
+               }
        }
 
        function task_shutdown() {
                $pid = posix_getpid();
 
-               if (file_exists(LOCK_DIRECTORY . "/update_daemon-$pid.lock"))
+               if (file_exists(LOCK_DIRECTORY . "/update_daemon-$pid.lock")) {
+                       _debug("removing lockfile ($pid)...");
                        unlink(LOCK_DIRECTORY . "/update_daemon-$pid.lock");
+               }
        }
 
        function sigint_handler() {
+               _debug("[MASTER] SIG_INT received.\n");
                shutdown();
-               die("[SIGINT] removing lockfile and exiting.\n");
+               die;
        }
 
        function task_sigint_handler() {
+               _debug("[TASK] SIG_INT received.\n");
                task_shutdown();
-               die("[SIGINT] removing lockfile and exiting.\n");
+               die;
        }
 
        pcntl_signal(SIGCHLD, 'sigchld_handler');