diff options
author | Andrew Dolgov <[email protected]> | 2013-02-25 21:36:18 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-02-25 21:36:18 +0400 |
commit | 2cd099f0fb10ec8a9be9ae9056480aa526e844ae (patch) | |
tree | ed3a0e66079fcee64d11630ac08ff77d66c79546 | |
parent | 724b7942ed5c2c60812f62801df98f2413980003 (diff) |
daemon: better shutdown/sigint reporting
-rwxr-xr-x | update_daemon2.php | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/update_daemon2.php b/update_daemon2.php index 8b1955818..4a6001b3f 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'); |