Skip to content

Commit 3d46303

Browse files
committed
Enabled locking mechanism for server script.
1 parent 797afa4 commit 3d46303

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

server/server.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,14 @@
4949
}
5050
*/
5151

52-
/*
52+
5353
// Check if another process is running
5454
if(is_file($conf["temppath"].$conf["fs_div"].".ispconfig_lock")){
5555
clearstatcache();
56-
for($i=0;$i<120;$i++){ // Wait max. 120 sec, then proceed
56+
for($i=0;$i<120;$i++){ // Wait max. 1200 sec, then proceed
5757
if(is_file($conf["temppath"].$conf["fs_div"].".ispconfig_lock")){
58-
sleep(1);
58+
$app->log("There is already a lockfile set. Waiting another 10 seconds...", LOGLEVEL_DEBUG);
59+
sleep(10);
5960
clearstatcache();
6061
}
6162
}
@@ -64,7 +65,7 @@
6465
// Set Lockfile
6566
@touch($conf["temppath"].$conf["fs_div"].".ispconfig_lock");
6667
$app->log("Set Lock: ".$conf["temppath"].$conf["fs_div"].".ispconfig_lock", LOGLEVEL_DEBUG);
67-
*/
68+
6869

6970
if($app->dbmaster->connect()) {
7071

@@ -116,11 +117,11 @@
116117
$app->log("Unable to connect to master server.",LOGLEVEL_ERROR);
117118
}
118119

119-
/*
120+
120121
// Remove lock
121122
@unlink($conf["temppath"].$conf["fs_div"].".ispconfig_lock");
122123
$app->log("Remove Lock: ".$conf["temppath"].$conf["fs_div"].".ispconfig_lock",LOGLEVEL_DEBUG);
123-
*/
124+
124125

125126
die("finished.\n");
126127
?>

0 commit comments

Comments
 (0)