From 3d46303ec61d08b006f2c32417486fd3bcb5f599 Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Sun, 01 Mar 2009 10:02:38 -0500 Subject: [PATCH] Enabled locking mechanism for server script. --- server/server.php | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/server/server.php b/server/server.php index 1cbdec7..e11e038 100644 --- a/server/server.php +++ b/server/server.php @@ -49,13 +49,14 @@ } */ -/* + // Check if another process is running if(is_file($conf["temppath"].$conf["fs_div"].".ispconfig_lock")){ clearstatcache(); - for($i=0;$i<120;$i++){ // Wait max. 120 sec, then proceed + for($i=0;$i<120;$i++){ // Wait max. 1200 sec, then proceed if(is_file($conf["temppath"].$conf["fs_div"].".ispconfig_lock")){ - sleep(1); + $app->log("There is already a lockfile set. Waiting another 10 seconds...", LOGLEVEL_DEBUG); + sleep(10); clearstatcache(); } } @@ -64,7 +65,7 @@ // Set Lockfile @touch($conf["temppath"].$conf["fs_div"].".ispconfig_lock"); $app->log("Set Lock: ".$conf["temppath"].$conf["fs_div"].".ispconfig_lock", LOGLEVEL_DEBUG); -*/ + if($app->dbmaster->connect()) { @@ -116,11 +117,11 @@ $app->log("Unable to connect to master server.",LOGLEVEL_ERROR); } -/* + // Remove lock @unlink($conf["temppath"].$conf["fs_div"].".ispconfig_lock"); $app->log("Remove Lock: ".$conf["temppath"].$conf["fs_div"].".ispconfig_lock",LOGLEVEL_DEBUG); -*/ + die("finished.\n"); ?> \ No newline at end of file -- Gitblit v1.9.1