From: Andrew Dolgov Date: Mon, 25 Feb 2013 17:28:34 +0000 (+0400) Subject: daemon: enable master lockfile X-Git-Tag: 1.7.1~43 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=1a43a68cb107205d43fee40a1d71cc998d6abc74;p=tt-rss.git daemon: enable master lockfile --- diff --git a/update_daemon2.php b/update_daemon2.php index f2a96262..cee61bb6 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');