diff --git a/install/install.php b/install/install.php index 9474eb5b08a0eaa3c93f72b9edfb4d9f8a1ca8cc..67651701b44eb737108e558e16c6f0aee8b3caf2 100644 --- a/install/install.php +++ b/install/install.php @@ -53,6 +53,10 @@ require_once('lib/install.lib.php'); //** Include the base class of the installer class require_once('lib/installer_base.lib.php'); +//** Ensure that current working directory is install directory +$cur_dir = getcwd(); +if(realpath(dirname(__FILE__)) != $cur_dir) die("Please run installation/update from _inside_ the install directory!\n"); + //** Install logfile define('ISPC_LOG_FILE', '/var/log/ispconfig_install.log'); define('ISPC_INSTALL_ROOT', realpath(dirname(__FILE__).'/../')); diff --git a/install/update.php b/install/update.php index 727dfd0e53c7672bdbf830a53157e2a07d5c3683..2fb2d9b6abb217a96c6cfe1db5b5e439b75fe6a1 100644 --- a/install/update.php +++ b/install/update.php @@ -53,6 +53,10 @@ require_once('lib/install.lib.php'); //** Include the base class of the installer class require_once('lib/installer_base.lib.php'); +//** Ensure that current working directory is install directory +$cur_dir = getcwd(); +if(realpath(dirname(__FILE__)) != $cur_dir) die("Please run installation/update from _inside_ the install directory!\n"); + //** Install logfile define('ISPC_LOG_FILE', '/var/log/ispconfig_install.log'); define('ISPC_INSTALL_ROOT', realpath(dirname(__FILE__).'/../')); diff --git a/server/server.php b/server/server.php index 3646f81dabe1096e62197c33a8ffbe9e580f5862..fcb7e81644bda712153fbcdeae90801a07b3ba57 100644 --- a/server/server.php +++ b/server/server.php @@ -56,6 +56,11 @@ if(is_file($conf["temppath"].$conf["fs_div"].".ispconfig_lock")){ clearstatcache(); for($i=0;$i<1200;$i++){ // Wait max. 1200 sec, then proceed if(is_file($conf["temppath"].$conf["fs_div"].".ispconfig_lock")){ + exec("ps aux | grep '/usr/local/ispconfig/server/server.php' | grep -v 'grep' | wc -l", $check); + if(intval($check[0]) > 1) { // 1 because this is 2nd instance! + $app->log("There is already an instance of server.php running. Exiting.", LOGLEVEL_DEBUG); + exit; + } $app->log("There is already a lockfile set. Waiting another 10 seconds...", LOGLEVEL_DEBUG); sleep(10); clearstatcache();