daemon: better shutdown/sigint reporting
This commit is contained in:
parent
724b7942ed
commit
2cd099f0fb
1 changed files with 10 additions and 4 deletions
|
@ -87,25 +87,31 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function shutdown() {
|
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");
|
unlink(LOCK_DIRECTORY . "/update_daemon.lock");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function task_shutdown() {
|
function task_shutdown() {
|
||||||
$pid = posix_getpid();
|
$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");
|
unlink(LOCK_DIRECTORY . "/update_daemon-$pid.lock");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function sigint_handler() {
|
function sigint_handler() {
|
||||||
|
_debug("[MASTER] SIG_INT received.\n");
|
||||||
shutdown();
|
shutdown();
|
||||||
die("[SIGINT] removing lockfile and exiting.\n");
|
die;
|
||||||
}
|
}
|
||||||
|
|
||||||
function task_sigint_handler() {
|
function task_sigint_handler() {
|
||||||
|
_debug("[TASK] SIG_INT received.\n");
|
||||||
task_shutdown();
|
task_shutdown();
|
||||||
die("[SIGINT] removing lockfile and exiting.\n");
|
die;
|
||||||
}
|
}
|
||||||
|
|
||||||
pcntl_signal(SIGCHLD, 'sigchld_handler');
|
pcntl_signal(SIGCHLD, 'sigchld_handler');
|
||||||
|
|
Loading…
Reference in a new issue