mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-18 14:31:30 +00:00
update_daemon2: fix locking
This commit is contained in:
@@ -32,13 +32,22 @@
|
|||||||
pcntl_signal(SIGCHLD, 'sigchld_handler');
|
pcntl_signal(SIGCHLD, 'sigchld_handler');
|
||||||
pcntl_signal(SIGINT, 'sigint_handler');
|
pcntl_signal(SIGINT, 'sigint_handler');
|
||||||
|
|
||||||
$lock_handle = make_lockfile("update_daemon.lock");
|
if (file_is_locked("update_daemon.lock")) {
|
||||||
|
die("error: Can't create lockfile. ".
|
||||||
if (!$lock_handle) {
|
|
||||||
die("error: Can't create lockfile ($lock_filename). ".
|
|
||||||
"Maybe another daemon is already running.\n");
|
"Maybe another daemon is already running.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!pcntl_fork()) {
|
||||||
|
$lock_handle = make_lockfile("update_daemon.lock");
|
||||||
|
|
||||||
|
if (!$lock_handle) {
|
||||||
|
die("error: Can't create lockfile. ".
|
||||||
|
"Maybe another daemon is already running.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
while (true) { sleep(100); }
|
||||||
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
$next_spawn = $last_checkpoint + SPAWN_INTERVAL - time();
|
$next_spawn = $last_checkpoint + SPAWN_INTERVAL - time();
|
||||||
|
|||||||
Reference in New Issue
Block a user