daemon: enable master lockfile

This commit is contained in:
Andrew Dolgov 2013-02-25 21:28:34 +04:00
parent 7c9f819f1e
commit 1a43a68cb1
1 changed files with 8 additions and 0 deletions

View File

@ -113,6 +113,14 @@
"Maybe another daemon is already running.\n");
}
// Try to lock a file in order to avoid concurrent update.
$lock_handle = make_lockfile("update_daemon.lock");
if (!$lock_handle) {
die("error: Can't create lockfile. ".
"Maybe another daemon is already running.\n");
}
/* if (!pcntl_fork()) {
pcntl_signal(SIGINT, 'sigint_handler');
register_shutdown_function('shutdown');