source: repoman/bin/sendFileMcast @ 813f617

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 813f617 was aa91bf5, checked in by adv <adv@…>, 14 years ago

branch version 1.0 log REPOMAN: ogAdmRepoAux >> ogAdmRepo.log sendFileMcast >> ogAdmRepoMulticast.log

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

  • Property mode set to 100755
File size: 2.4 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" >&2
23    exit 1
24fi
25
26# Fichero de imagen (camino completo o nombre de imagen sin extensión).
27FICH="$1"
28if [ "${FICH:0:1}" != "/" ]; then
29    for EXT in pgz img; do
30        FICHIMG="$OGIMG/$FICH.$EXT"
31        [ -r "$FICHIMG" ] && break
32    done
33else
34    FICHIMG="$FICH"
35fi
36if [ ! -f "$FICHIMG" ]; then
37    echo "$PROG Error: Fichero \"$FICH\" no accesible" >&2
38    exit 2
39fi
40
41# Parámetros de sesión separado por ":".
42PARAMS=$(echo $2 | \
43        awk -F: '$1~/^[0-9]*$/ {print $1}
44                 tolower($2)~/^(half)(-duplex)?$/ {print "half-duplex"}
45                 tolower($2)~/^(full)(-duplex)?$/ {print "full-duplex"}
46                 $3~/^[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*$/ {print $3}
47                 $4~/^[0-9]*[mM]/ {print toupper($4)}
48                 $5~/^[0-9]*/ {print $5}
49                 $6~/^[0-9]*/ {print $6}
50                ')
51read -e PORTBASE METHOD ADDRESS BITRATE NCLIENTS MAXTIME <<< $PARAMS
52if [ -z "$MAXTIME" ]; then
53    echo "$PROG Error: Datos de sesión incorrectos: \"$2\"" >&2
54    exit 1
55fi
56
57# Valores estandar no configurables.
58CERROR="8x8/128"
59
60# Envío de fichero por Multicast.
61which mbuffer &> /dev/null && MBUFFER="--pipe 'mbuffer -m 20M'"
62##### ADV v. 1.0 23/02/2011
63#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"
64/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
65##### ADV v. 1.0  23/02/2011
Note: See TracBrowser for help on using the repository browser.