diff options
author | Andrew Dolgov <[email protected]> | 2013-04-17 18:19:26 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-04-17 18:19:28 +0400 |
commit | 7440a7fe3c43644cc3a90fe94e7c23795f04eeba (patch) | |
tree | 7cff1bf30db739c725f4cfa9dbdfeef7382ae93e /update.php | |
parent | eefaa2df381686f771396baae2d0ae71b345c2e7 (diff) |
daemon2: use passthrough to daemon-loop
Diffstat (limited to 'update.php')
-rwxr-xr-x | update.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/update.php b/update.php index abbe6c577..fcce26d5c 100755 --- a/update.php +++ b/update.php @@ -30,6 +30,7 @@ "quiet", "log:", "indexes", + "pidlock:", "update-schema", "convert-filters", "force-update", @@ -113,9 +114,23 @@ $lock_filename = $lock_filename . "-task_" . $options["task"]; } + if (isset($options["pidlock"])) { + $my_pid = $options["pidlock"]; + $lock_filename = "update_daemon-$my_pid.lock"; + + } + + _debug("Lock: $lock_filename"); + $lock_handle = make_lockfile($lock_filename); $must_exit = false; + if (isset($options["task"])) { + $waits = $options["task"] * 5; + _debug("Waiting before update ($waits)"); + sleep($waits); + } + // Try to lock a file in order to avoid concurrent update. if (!$lock_handle) { die("error: Can't create lockfile ($lock_filename). ". |