| | |
| | | require("lib/app.inc.php"); |
| | | |
| | | set_time_limit(0); |
| | | ini_set('error_reporting','E_ALL & ~E_NOTICE'); |
| | | |
| | | // make sure server_id is always an int |
| | | $conf["server_id"] = intval($conf["server_id"]); |
| | |
| | | clearstatcache(); |
| | | for($i=0;$i<120;$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(); |
| | |
| | | $app->log("Set Lock: ".$conf["temppath"].$conf["fs_div"].".ispconfig_lock", LOGLEVEL_DEBUG); |
| | | |
| | | |
| | | if($app->dbmaster->connect()) { |
| | | if($app->db->connect() && $app->dbmaster->connect()) { |
| | | |
| | | // get the dalaog_id of the last performed record |
| | | $server_db_record = $app->dbmaster->queryOneRecord("SELECT updated, config FROM server WHERE server_id = ".$conf["server_id"]); |
| | |
| | | $app->plugins->loadPlugins('core'); |
| | | } |
| | | } else { |
| | | $app->log("Unable to connect to master server.",LOGLEVEL_WARN); |
| | | if(!$app->db->connect()) { |
| | | $app->log("Unable to connect to local server.".$app->db->errorMessage,LOGLEVEL_WARN); |
| | | } else { |
| | | $app->log("Unable to connect to master server.".$app->dbmaster->errorMessage,LOGLEVEL_WARN); |
| | | } |
| | | } |
| | | |
| | | // Remove lock |
| | |
| | | |
| | | |
| | | die("finished.\n"); |
| | | ?> |
| | | ?> |