From: Andrew Dolgov Date: Mon, 25 Feb 2013 17:36:18 +0000 (+0400) Subject: daemon: better shutdown/sigint reporting X-Git-Tag: 1.7.1~40 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=2cd099f0fb10ec8a9be9ae9056480aa526e844ae;p=tt-rss.git daemon: better shutdown/sigint reporting --- diff --git a/update_daemon2.php b/update_daemon2.php index 8b195581..4a6001b3 100755 --- a/update_daemon2.php +++ b/update_daemon2.php @@ -87,25 +87,31 @@ } 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');