Skip to content

Commit df0089f

Browse files
author
mcramer
committed
- checking for correct working directory in install and update
- checking for running instance in server.php
1 parent 0866966 commit df0089f

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

install/install.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@
5353
//** Include the base class of the installer class
5454
require_once('lib/installer_base.lib.php');
5555

56+
//** Ensure that current working directory is install directory
57+
$cur_dir = getcwd();
58+
if(realpath(dirname(__FILE__)) != $cur_dir) die("Please run installation/update from _inside_ the install directory!\n");
59+
5660
//** Install logfile
5761
define('ISPC_LOG_FILE', '/var/log/ispconfig_install.log');
5862
define('ISPC_INSTALL_ROOT', realpath(dirname(__FILE__).'/../'));

install/update.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@
5353
//** Include the base class of the installer class
5454
require_once('lib/installer_base.lib.php');
5555

56+
//** Ensure that current working directory is install directory
57+
$cur_dir = getcwd();
58+
if(realpath(dirname(__FILE__)) != $cur_dir) die("Please run installation/update from _inside_ the install directory!\n");
59+
5660
//** Install logfile
5761
define('ISPC_LOG_FILE', '/var/log/ispconfig_install.log');
5862
define('ISPC_INSTALL_ROOT', realpath(dirname(__FILE__).'/../'));

server/server.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@
5656
clearstatcache();
5757
for($i=0;$i<1200;$i++){ // Wait max. 1200 sec, then proceed
5858
if(is_file($conf["temppath"].$conf["fs_div"].".ispconfig_lock")){
59+
exec("ps aux | grep '/usr/local/ispconfig/server/server.php' | grep -v 'grep' | wc -l", $check);
60+
if(intval($check[0]) > 1) { // 1 because this is 2nd instance!
61+
$app->log("There is already an instance of server.php running. Exiting.", LOGLEVEL_DEBUG);
62+
exit;
63+
}
5964
$app->log("There is already a lockfile set. Waiting another 10 seconds...", LOGLEVEL_DEBUG);
6065
sleep(10);
6166
clearstatcache();

0 commit comments

Comments
 (0)