summaryrefslogtreecommitdiffstats
path: root/admin/WebConsole/comandos
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2019-01-28 10:22:57 +0100
committerRamón M. Gómez <ramongomez@us.es>2019-01-29 14:55:27 +0100
commit2b00219981fbc33f1131390a6a051e7d9f2e8295 (patch)
treed1969ea61651ab9dab45037fd4ffaa8decd0c2b9 /admin/WebConsole/comandos
parent3f59ea6b3143ba850ce03161d08c2813d9f352f4 (diff)
#892: Use ogAdmServer Wake on Lan
* gestor_Comando.php only execute wakeonlan_repo.php when wake up command is called. * wakeonlan_repo.php send new needed parameters for ogAdmServer WoL. * repository.php use ogAdmServer WoL instead of wakeonlan perl script. * opengnsys_installer.sh and opengnsys_update.sh don't have wakeonlan perl script dependency anymore. # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Mon Jan 28 10:22:57 2019 +0100 # # On branch devel # Your branch is ahead of 'origin/devel' by 1 commit. # (use "git push" to publish your local commits) # # Changes to be committed: # modified: admin/WebConsole/comandos/gestores/gestor_Comandos.php # modified: admin/WebConsole/comandos/gestores/wakeonlan_repo.php # modified: admin/WebConsole/rest/repository.php # modified: installer/opengnsys_installer.sh # modified: installer/opengnsys_update.sh # # Untracked files: # 0001-892-Use-ogAdmServer-Wake-on-Lan.patch # 0001-892-Use-ogAdmServer-Wake-on-Lan.zip #
Diffstat (limited to 'admin/WebConsole/comandos')
-rw-r--r--admin/WebConsole/comandos/gestores/gestor_Comandos.php7
-rw-r--r--admin/WebConsole/comandos/gestores/wakeonlan_repo.php11
2 files changed, 13 insertions, 5 deletions
diff --git a/admin/WebConsole/comandos/gestores/gestor_Comandos.php b/admin/WebConsole/comandos/gestores/gestor_Comandos.php
index b2a81b79..a4bcfbb0 100644
--- a/admin/WebConsole/comandos/gestores/gestor_Comandos.php
+++ b/admin/WebConsole/comandos/gestores/gestor_Comandos.php
@@ -20,6 +20,10 @@ include_once("../../includes/RecopilaIpesMacs.php");
//________________________________________________________________________________________________________
include_once("../includes/capturaacciones.php");
//________________________________________________________________________________________________________
+
+define("IDCOMANDWAKEUP", 1);
+define("IDCOMANDSENDMESSAGE", 16);
+
// Recoge parametros de seguimiento
$sw_ejya="";
$sw_seguimiento="";
@@ -174,8 +178,7 @@ if($sw_ejya=='on' || $sw_ejprg=="on" ){
$ValorParametros=extrae_parametros($parametros,chr(13),'=');
$script=@urldecode($ValorParametros["scp"]);
if($sw_ejya=='on'){
- // comando 16 sólo agente nuevo
- if ($idcomando != 16){
+ if ($idcomando != IDCOMANDSENDMESSAGE && $idcomando != IDCOMANDWAKEUP) {
// Envio al servidor
$shidra=new SockHidra($servidorhidra,$hidraport);
if ($shidra->conectar()){ // Se ha establecido la conexión con el servidor hidra
diff --git a/admin/WebConsole/comandos/gestores/wakeonlan_repo.php b/admin/WebConsole/comandos/gestores/wakeonlan_repo.php
index 1440c0be..ee254d0d 100644
--- a/admin/WebConsole/comandos/gestores/wakeonlan_repo.php
+++ b/admin/WebConsole/comandos/gestores/wakeonlan_repo.php
@@ -43,19 +43,24 @@ foreach($macs as $mac){
}
$rs->Cerrar();
}
+
+//Multicast or Unicast
+$typeWol = preg_match_all('!\d{1}!', $atributos, $matches);
+
// En este punto tenemos un array con todos los repos y cada uno de ellos con una lista de todas las macs que deben arrancar
// Recorremos cada uno de ellos
foreach($reposAndMacs as $repo => $macs){
// En el array de $macs tenemos la clave "apikey"
- if($macs["apikey"] !== ""){
+ if($macs["apikey"] !== "") {
$apiKeyRepo = $macs["apikey"];
unset($macs["apikey"]);
// Componer datos de conexión para el repositorio.
$urls[$repo]['url'] = "https://$repo/opengnsys/rest/repository/poweron";
$urls[$repo]['header'] = array('Authorization: '. $apiKeyRepo);
- $urls[$repo]['post'] = '{"macs": ["' . implode('","', $macs) . '"]}';
+ $urls[$repo]['post'] = '{"macs": ["' . implode('","', $macs) . '"], "ips": ["' . str_replace(';', '","', $cadenaip) .
+ '"], "mar": "' . $matches[0][0] . '"}';
}
- else{
+ else {
$avisoRepo = true;
}
}