source: repoman/bin/sendFileMcast @ 31d4f1a5

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-instalacionwebconsole3
Last change on this file since 31d4f1a5 was 9dbaa9e7, checked in by irina <irinagomez@…>, 12 years ago

sendFileMcast: ttl a 16, resuelve problema multicast en algunas redes

git-svn-id: https://opengnsys.es/svn/branches/version1.0@3948 a21b9725-9963-47de-94b9-378ad31fedc9

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