summaryrefslogtreecommitdiff
path: root/update_daemon2.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-02-25 21:36:18 +0400
committerAndrew Dolgov <[email protected]>2013-02-25 21:36:18 +0400
commit2cd099f0fb10ec8a9be9ae9056480aa526e844ae (patch)
treeed3a0e66079fcee64d11630ac08ff77d66c79546 /update_daemon2.php
parent724b7942ed5c2c60812f62801df98f2413980003 (diff)
daemon: better shutdown/sigint reporting
Diffstat (limited to 'update_daemon2.php')
-rwxr-xr-xupdate_daemon2.php14
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');