]> git.wh0rd.org - tt-rss.git/blobdiff - update_daemon2.php
update_daemon2: only set SIGINT handler in lock managing subprocess
[tt-rss.git] / update_daemon2.php
index 326b69e49dce1905d22f9c98c7567bb994fd4e9a..e7b5aeb202d948fff592b882aee7caa75ad52431 100644 (file)
@@ -61,7 +61,7 @@
        }
 
        function sigalrm_handler() {
-               die("received SIGALRM, hang in feed update?\n");
+               die("[SIGALRM] hang in feed update?\n");
        }
 
        function sigchld_handler($signal) {
 
        function sigint_handler() {
                unlink(LOCK_DIRECTORY . "/update_daemon.lock");
-               die("Received SIGINT. Exiting.\n");
+               die("[SIGINT] removing lockfile and exiting.\n");
        }
 
        pcntl_signal(SIGALRM, 'sigalrm_handler');
        pcntl_signal(SIGCHLD, 'sigchld_handler');
-       pcntl_signal(SIGINT, 'sigint_handler');
 
        if (file_is_locked("update_daemon.lock")) {
                die("error: Can't create lockfile. ".
@@ -92,6 +91,8 @@
        }
 
        if (!pcntl_fork()) {
+               pcntl_signal(SIGINT, 'sigint_handler');
+
                $lock_handle = make_lockfile("update_daemon.lock");
 
                if (!$lock_handle) {
 
                                        if (DAEMON_SENDS_DIGESTS) send_headlines_digests($link);
 
-                                       print "Elapsed time: " . (time() - $start_timestamp) . " second(s)\n";
+                                       _debug("Elapsed time: " . (time() - $start_timestamp) . " second(s)");
 
                                        db_close($link);