summaryrefslogtreecommitdiff
path: root/update_daemon2.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-02-25 21:28:34 +0400
committerAndrew Dolgov <[email protected]>2013-02-25 21:28:34 +0400
commit1a43a68cb107205d43fee40a1d71cc998d6abc74 (patch)
tree1b7b71fda04cb33d7407efc62d6c01d3f0fb5c81 /update_daemon2.php
parent7c9f819f1e1e7e50c76be3a1cf25ec6c99c26a03 (diff)
daemon: enable master lockfile
Diffstat (limited to 'update_daemon2.php')
-rwxr-xr-xupdate_daemon2.php8
1 files changed, 8 insertions, 0 deletions
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');