source: repoman/bin/sendFileMcast @ fd11e20

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 fd11e20 was fd11e20, checked in by ramon <ramongomez@…>, 15 years ago

Comprobación de parámetros en script sendFileMcast.

git-svn-id: https://opengnsys.es/svn/trunk@1111 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100755
File size: 1.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)
8 
9# Si se solicita, mostrar ayuda.
10if [ "$*" == "help" ]; then
11    echo "Formato: $PROG fichero datosMulticast"
12    echo "Ejemplo: $PROG /opt/opengnsys/images/PS1_PH1.img 9000:full-duplex:239.194.17.2:70M:20:300"
13    exit 0
14fi
15# Error si no se reciben 2 parámetros.
16if [ $# -ne 2 ]; then
17    echo "Error: Formato: $PROG fichero datosMulticast" >&2
18    exit 1
19fi
20
21# Parámetros de sesión separado por ":".
22PARAMS=$(echo $2 | \
23        awk -F: '$1~/^[0-9]*$/ {print $1}
24                 tolower($2)~/^(half)(-duplex)?$/ {print "half-duplex"}
25                 tolower($2)~/^(full)(-duplex)?$/ {print "full-duplex"}
26                 $3~/^[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*$/ {print $3}
27                 $4~/^[0-9]*[mM]/ {print $4}
28                 $5~/^[0-9]*/ {print $5}
29                 $6~/^[0-9]*/ {print "$6"}
30                ')
31read -e PORTBASE METHOD ADDRESS BITRATE NCLIENTS MAXTIME <<< $PARAMS
32
33# Valores estandar no configurables.
34CERROR="8x8/128"
35
36# Envío de fichero por Multicast.
37which mbuffer &> /dev/null && MBUFFER="--pipe 'mbuffer -m 20M'"
38udp-sender $MBUFFER --portbase $PORTBASE --$METHOD --mcast-data-address $ADDRESS --fec $CERROR --max-bitrate $BITRATE --ttl 1 --min-clients $NCLIENTS --max-wait $MAXTIME --file "$1"
39
40
Note: See TracBrowser for help on using the repository browser.