From 1a43a68cb107205d43fee40a1d71cc998d6abc74 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 25 Feb 2013 21:28:34 +0400 Subject: [PATCH] daemon: enable master lockfile --- update_daemon2.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/update_daemon2.php b/update_daemon2.php index f2a962629..cee61bb6e 100755 --- a/update_daemon2.php +++ b/update_daemon2.php @@ -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');