source: repoman/bin/sendFileMcast @ b411a0f

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 b411a0f was 01ae374d, checked in by Fredy <aluque@…>, 7 years ago

Added main repo interface parameter to sendFileMcast script to solve problems when more than one interface are available

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