Quellcode durchsuchen

Merge branch 'master' of ssh://biuro.biall-net.pl:2222/plabudda/se

Piotr Labudda vor 9 Jahren
Ursprung
Commit
e0b305f286
1 geänderte Dateien mit 14 neuen und 8 gelöschten Zeilen
  1. 14 8
      SE/superedit-INSTALL_SES_PROCESY_A.php

+ 14 - 8
SE/superedit-INSTALL_SES_PROCESY_A.php

@@ -2862,9 +2862,9 @@ function INSTALL_SES_PROCESY_A() {
             if ($h->SERVER_ADDRESS_IP == long2ip(ip2long($subnet) | ~ip2long($subnets[$subnet]["mask"]))) throw new Exception("Adres IP ".$h->SERVER_ADDRESS_IP." jest adresem rozgłoszeniowym dla podsieci ".$subnet."/".$subnets[$subnet]["mask"].". Należy wybrać inny adres IP z puli adresów.<br/>Dostępne pule: ".$availableSubnets);
             DEBUG_S(-3, 'Adres IP serwera należy do znanej puli adresów', 'OK');
             
-            exec("ping ".$h->SERVER_ADDRESS_IP." -c 2 -t 1 >/dev/null", $output, $exit);
+            exec("ping ".$h->SERVER_ADDRESS_IP." -i 0.2 -t 1", $output, $exit);
             if (!$exit) throw new Exception('Błąd - maszyna o adresie IP '.$h->SERVER_ADDRESS_IP.' już istnieje (odpowiada na "pingi").');
-            DEBUG_S(-3, 'Brak maszyny w sieci o adresie IP'.$h->SERVER_ADDRESS_IP, 'OK');
+            DEBUG_S(-3, 'Brak maszyny w sieci o adresie IP '.$h->SERVER_ADDRESS_IP, 'OK');
             
             $result = execOnParallels('prlctl status "'.$h->SERVER_ADDRESS.'"');
             if ($result) throw new Exception("Maszyna wirtualna o nazwie ".$h->SERVER_ADDRESS." już istnieje!");
@@ -2935,16 +2935,16 @@ echo \''.$plist.'\' > /Library/LaunchDaemons/parallels.'.$h->SERVER_ADDRESS.'.pl
             DEBUG_S(-3, 'Ustawienie serwera DNS', $result);
             sleep(2);
 
-            exec("ping ".$h->SERVER_ADDRESS_IP." -c 5 -t 1 >/dev/null", $output, $exit);
-            if (!$exit) {
+            exec("ping ".$h->SERVER_ADDRESS_IP." -i 0.2 -t 1", $output, $exit);
+            DEBUG_S(-3, 'Weryfikacja czy maszyna wirtualna odpowiada na "pingi"', $output);
+            if ($exit) {
                 execOnParallels('sudo launchctl unload /Library/LaunchDaemons/parallels.'.$h->SERVER_ADDRESS.'.plist');
                 execOnParallels('sudo rm -f /Library/LaunchDaemons/parallels.'.$h->SERVER_ADDRESS.'.plist');
                 execOnParallels('prlctl stop "'.$h->SERVER_ADDRESS.'" --kill');
                 execOnParallels('prlctl delete "'.$h->SERVER_ADDRESS.'"');
                 throw new Exception('Błąd - maszyna wirtualna nie odpowiada na pingi, usuwam maszynę i przerywam...');
             }
-            DEBUG_S(-3, 'Maszyna wirtualna odpowiada na "pingi"', $output);
-
+            
             $cmd = 'prlctl exec "'.$h->SERVER_ADDRESS.'" \'/Applications/Server.app/Contents/ServerRoot/usr/sbin/changeip '.$h->SERVER_ADDRESS_IP.' procesy5 "'.$h->SERVER_ADDRESS_IP.'"\'';
             $result = execOnParallels($cmd);
             DEBUG_S(-3, $cmd, $result);
@@ -2997,7 +2997,7 @@ echo \''.$plist.'\' > /Library/LaunchDaemons/parallels.'.$h->SERVER_ADDRESS.'.pl
         
     } else if(!empty($_REQUEST['STATUS_INSTALACJI_NA_PARALLELS'])) {
         try {
-            $cmd = 'prlctl exec "'.$h->SERVER_ADDRESS.'" \'[ -f "/var/root/procesy5_install.started" ] && echo 1\'';
+            $cmd = 'prlctl exec "'.$h->SERVER_ADDRESS.'" \'[ -f "/var/root/procesy5_install.started" ] && echo 1\' 2>/dev/null';
             $result = execOnParallels($cmd);
             if (!$result) throw new Exception("Błąd - automatyczna instalacja Procesy5 na wirtualnej maszynie ".$h->SERVER_ADDRESS." nie została uruchomiona.");
             
@@ -3011,12 +3011,18 @@ echo \''.$plist.'\' > /Library/LaunchDaemons/parallels.'.$h->SERVER_ADDRESS.'.pl
                 }
                 echo "</b></font><br/><br/>";
             } else {
-                $cmd = 'prlctl exec biuro.bzyk.org \'ps ax|egrep "installer.*4_Procesy5|install\.bash"|grep -v grep\'';
+                $cmd = 'prlctl exec '.$h->SERVER_ADDRESS.' \'ps ax|egrep "[i]nstaller.*_Procesy5|install\.bash"\'';
                 $result = execOnParallels($cmd);
                 if ($result) {
                     echo "<br/><font size=4 color=orange><b>Instalacja Procesy5 na ".$h->SERVER_ADDRESS." w trakcie. Odśwież stronę celem ponownej weryfikacji stanu
                     instalacji.</b></font><br/><br/>";
                     DEBUG_S(-3, "Uruchomione procesy", "<pre>".$result."</pre>");
+                    $script = trim(substr($result, strrpos($result, " ")));
+                    if (preg_match("/^\/tmp\/.*$/", $script)) {
+                        $cmd = 'prlctl exec "'.$h->SERVER_ADDRESS.'" \'[ -f "'.$script.'" ] && cat "'.$script.'"\'';
+                        $result = execOnParallels($cmd);
+                        if ($result) DEBUG_S(-3, "Aktualnie wyzwolony skrypt", "<pre>".$script.":\n\n".$result."</pre>");
+                    }
                 }
                 else echo "<br/><font size=4 color=red><b>Instalacja Procesy5 na ".$h->SERVER_ADDRESS." zakończyła się niepowodzeniem.</b></font><br/><br/>";
             }