diff options
author | adv <adv@uma.es> | 2011-04-14 20:09:27 +0000 |
---|---|---|
committer | adv <adv@uma.es> | 2011-04-14 20:09:27 +0000 |
commit | e8460d24b1f422ee143e401cda13049f586370bf (patch) | |
tree | 28c19ddad4fe46f8240303161e6e1bcdb4774f72 | |
parent | c4cdab6bdc609811e5673ddec35bcd76687c8894 (diff) |
version1.0 #369 controlando errores de inicio de multicast
git-svn-id: https://opengnsys.es/svn/branches/version1.0@1863 a21b9725-9963-47de-94b9-378ad31fedc9
-rwxr-xr-x | admin/Sources/Services/ogAdmRepoAux | 28 | ||||
-rwxr-xr-x | client/shared/scripts/updateCache | 17 | ||||
-rwxr-xr-x | repoman/bin/sendFileMcast | 10 |
3 files changed, 44 insertions, 11 deletions
diff --git a/admin/Sources/Services/ogAdmRepoAux b/admin/Sources/Services/ogAdmRepoAux index ddbe07ef..9dd4b0bb 100755 --- a/admin/Sources/Services/ogAdmRepoAux +++ b/admin/Sources/Services/ogAdmRepoAux @@ -1,10 +1,22 @@ #!/bin/bash PARM=`cat` +#TODO: ticket 379 +#buscar parametro de identificador de operacion. +#usar parametro de identificacion para anexarlo al nombre de log +#Comprobar si la variable está seteas. +#Si no lo está setearla. +#Si esta seteada (en progreso) salir. + + + BASEDIR=/opt/opengnsys REPONAME=ogAdmRepo REPOLOG=$BASEDIR/log/$REPONAME.log +MCASTLOGBASE=$BASEDIR/log/mcastlog +MCASTLOG=$MCASTLOGBASE/ogAdmRepoMcast.`date +%Y%m%d-%H%M%S` +mkdir -p $MCASTLOGBASE PARM1=$(echo $PARM | cut -f1 -d" ") PARM2=$(echo $PARM | cut -f2 -d" ") @@ -19,9 +31,19 @@ case $PARM1 in #3 opciones de multicast FILE=/opt/opengnsys/images$PARM2 MCASTOPT=$PARM3 - echo "/opt/opengnsys/bin/sendFileMcast $FILE $MCASTOPT" >> $REPOLOG - /opt/opengnsys/bin/sendFileMcast $FILE $MCASTOPT >> $REPOLOG - echo $? >> $REPOLOG + echo `date +%Y%m%d-%H%M%S` "/opt/opengnsys/bin/sendFileMcast $FILE $MCASTOPT" >> $REPOLOG + /opt/opengnsys/bin/sendFileMcast $FILE $MCASTOPT &>> $MCASTLOG + case $? in + 1) + echo `date +%Y%m%d-%H%M%S` Parametros insuficientes >> $REPOLOG + ;; + 2) + echo `date +%Y%m%d-%H%M%S` Fichero no accesible >> $REPOLOG + ;; + 3) + echo `date +%Y%m%d-%H%M%S` sesion multicast no valida >> $REPOLOG + ;; + esac ;; default) echo "Solicitud con parametros: - $PARM - no realizada: No registrada o con errores" >> $REPOLOG diff --git a/client/shared/scripts/updateCache b/client/shared/scripts/updateCache index 388bea26..f6f61e34 100755 --- a/client/shared/scripts/updateCache +++ b/client/shared/scripts/updateCache @@ -71,17 +71,28 @@ case "$PROTOCOLO" in echo "determinando puerto principal y auxiliar." PORT=$(echo $OPTPROTOCOLO | cut -f1 -d":") let PORTAUX=$PORT+1 + #TODO: ticket 379 + NUMBER=$[ ( $RANDOM % 30 ) + 1 ] + sleep $NUMBER + #FIN TODO echo "comprobando puerto $PORTAUX en $REPOIP (sesion multicast en puerto $PORT) " if (nmap -n -sU -p $PORTAUX $REPOIP | grep open) then ogMcastReceiverFile $PORT CACHE $2 else + # TODO ticket 379 Realizar la petición basada en identificador de operacion echo "solicita la apertura: hose $REPOIP 2009 --out sh -c "echo -ne START_MULTICAST $2 $OPTPROTOCOLO"" hose $REPOIP 2009 --out sh -c "echo -ne START_MULTICAST $2 $OPTPROTOCOLO" #echo "espero y llamo a: ogMcastReceiverFile $PORT CACHE $2" - sleep 30 - ogMcastReceiverFile $PORT CACHE $2 - fi + sleep 10 + if (nmap -n -sU -p $PORTAUX $REPOIP | grep open) + then + ogMcastReceiverFile $PORT CACHE $2 + else + echo "la peticion ha fallado: hose $REPOIP 2009 --out sh -c echo -ne START_MULTICAST $2 $OPTPROTOCOLO" + exit 1 + fi + fi ;; unicast | UNICAST ) echo "unicast" diff --git a/repoman/bin/sendFileMcast b/repoman/bin/sendFileMcast index 4a4afb60..b1c124f1 100755 --- a/repoman/bin/sendFileMcast +++ b/repoman/bin/sendFileMcast @@ -19,7 +19,7 @@ if [ "$*" == "help" ]; then fi # Error si no se reciben 2 parámetros. if [ $# -ne 2 ]; then - echo "$PROG Error: Formato: $PROG fichero|nombreImagen datosMulticast" >&2 + echo "$PROG Error: Formato: $PROG fichero|nombreImagen datosMulticast" exit 1 fi @@ -34,7 +34,7 @@ else FICHIMG="$FICH" fi if [ ! -f "$FICHIMG" ]; then - echo "$PROG Error: Fichero \"$FICH\" no accesible" >&2 + echo "$PROG Error: Fichero \"$FICH\" no accesible" exit 2 fi @@ -50,8 +50,8 @@ PARAMS=$(echo $2 | \ ') read -e PORTBASE METHOD ADDRESS BITRATE NCLIENTS MAXTIME <<< $PARAMS if [ -z "$MAXTIME" ]; then - echo "$PROG Error: Datos de sesión incorrectos: \"$2\"" >&2 - exit 1 + echo "$PROG Error: Datos de sesión incorrectos: \"$2\"" + exit 3 fi # Valores estandar no configurables. @@ -62,6 +62,6 @@ which mbuffer &> /dev/null && MBUFFER="--pipe 'mbuffer -m 20M'" ##### ADV v. 1.0 23/02/2011 #version 0.10 # udp-sender $MBUFFER --portbase $PORTBASE --$METHOD --mcast-data-address $ADDRESS --fec $CERROR --max-bitrate $BITRATE --ttl 1 --min-clients $NCLIENTS --max-wait $MAXTIME --file "$FICHIMG" #/opt/opengnsys/bin/udp-sender $MBUFFER --nokbd --retries-until-drop 65 --portbase $PORTBASE --$METHOD --mcast-data-address $ADDRESS --fec $CERROR --max-bitrate $BITRATE --ttl 1 --min-clients $NCLIENTS --max-wait $MAXTIME --file "$FICHIMG" --log /opt/opengnsys/log/ogAdmRepoMcast.log -/opt/opengnsys/bin/udp-sender $MBUFFER --nokbd --retries-until-drop 65 --portbase $PORTBASE --$METHOD --mcast-data-address $ADDRESS --fec $CERROR --max-bitrate $BITRATE --ttl 1 --min-clients $NCLIENTS --max-wait $MAXTIME --file "$FICHIMG" >> /opt/opengnsys/log/ogAdmRepoMcast.log +/opt/opengnsys/bin/udp-sender $MBUFFER --nokbd --retries-until-drop 65 --portbase $PORTBASE --$METHOD --mcast-data-address $ADDRESS --fec $CERROR --max-bitrate $BITRATE --ttl 1 --min-clients $NCLIENTS --max-wait $MAXTIME --file "$FICHIMG" ##### ADV v. 1.0 23/02/2011 |