source: repoman/bin/sendFileMcast @ 7534054

918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacion
Last change on this file since 7534054 was 71b93c5d, checked in by Irina Gómez <irinagomez@…>, 6 years ago

Fixs multicast error: create 'read' alias defining line break character as default delimiter.

  • Property mode set to 100755
File size: 2.2 KB
RevLine 
[85b029f]1#!/bin/bash
2#@brief   Envía un fichero por multicast   ORIGEN(fichero) DESTINO(sessionmulticast)
3#@param   path_file      Camino completo del fichero a enviar
4#@param   str_session    Datos de sesión (Puerto:Duplex:IP:Mpbs:Nclientes:Timeout)
5
6
7PROG=$(basename $0)
[526298b]8OPENGNSYS=${OPENGNSYS:-"/opt/opengnsys"}
9OGIMG=$OPENGNSYS/images
10OGBIN=$OPENGNSYS/bin
11PATH=$PATH:$OGBIN
[01ae374d]12REPO_IFACE="$(/opt/opengnsys/bin/getRepoIface)"
13
[71b93c5d]14# Compatibilidad con Ubuntu 18
15source $OPENGNSYS/lib/osadapter.sh
16
[85b029f]17# Si se solicita, mostrar ayuda.
18if [ "$*" == "help" ]; then
[526298b]19    echo "Formato: $PROG fichero|nombreImagen datosMulticast"
[cdc5f1f]20    echo "Ejemplo: $PROG /opt/opengnsys/images/imagen1.pgz 9000:full-duplex:239.194.17.2:70M:20:120"
21    echo "Ejemplo: $PROG imagen1 9000:full:239.194.17.2:70M:20:120"
[85b029f]22    exit 0
23fi
24# Error si no se reciben 2 parámetros.
25if [ $# -ne 2 ]; then
[e8460d2]26    echo "$PROG Error: Formato: $PROG fichero|nombreImagen datosMulticast"
[85b029f]27    exit 1
28fi
29
[bfc4d9c]30# Fichero a enviar (camino completo o relativo al directorio del repositorio).
[526298b]31FICH="$1"
[e031dd38]32if [ "${FICH:0:15}" != "$OPENGNSYS" ]; then
[bfc4d9c]33    FICHIMG="$OGIMG/$FICH"
[cdc5f1f]34else
35    FICHIMG="$FICH"
36fi
[3f9764a]37if [ ! -f "$FICHIMG" ]; then
[bfc4d9c]38    echo "$PROG Error: Fichero \"$FICHIMG\" no accesible"
[526298b]39    exit 2
40fi
41
[85b029f]42# Parámetros de sesión separado por ":".
[fd11e20]43PARAMS=$(echo $2 | \
44        awk -F: '$1~/^[0-9]*$/ {print $1}
45                 tolower($2)~/^(half)(-duplex)?$/ {print "half-duplex"}
46                 tolower($2)~/^(full)(-duplex)?$/ {print "full-duplex"}
47                 $3~/^[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*$/ {print $3}
[526298b]48                 $4~/^[0-9]*[mM]/ {print toupper($4)}
[fd11e20]49                 $5~/^[0-9]*/ {print $5}
[526298b]50                 $6~/^[0-9]*/ {print $6}
[fd11e20]51                ')
52read -e PORTBASE METHOD ADDRESS BITRATE NCLIENTS MAXTIME <<< $PARAMS
[526298b]53if [ -z "$MAXTIME" ]; then
[e8460d2]54    echo "$PROG Error: Datos de sesión incorrectos: \"$2\""
55    exit 3
[526298b]56fi
[85b029f]57
[fd11e20]58# Valores estandar no configurables.
59CERROR="8x8/128"
[85b029f]60
61# Envío de fichero por Multicast.
[c66eccd]62# Se desabilita el uso de mbuffer: eesta versión del upd-sender no la admite.
63#which mbuffer &> /dev/null && MBUFFER="--pipe 'mbuffer -m 20M'"
[01ae374d]64$OGBIN/udp-sender $MBUFFER --nokbd --retries-until-drop 65 --portbase $PORTBASE --$METHOD --interface $REPO_IFACE --mcast-data-address $ADDRESS --fec $CERROR --max-bitrate $BITRATE --ttl 16 --min-clients $NCLIENTS --max-wait $MAXTIME --file "$FICHIMG"
[3cd3133]65
Note: See TracBrowser for help on using the repository browser.