Infosatepg.sh

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
Zeile 1: Zeile 1:
 
  #!/bin/sh
 
  #!/bin/sh
 
  #
 
  #
  # infosatepg.sh - v.0.4
+
  # infosatepg.sh - v.0.5
 
  #
 
  #
 
  # add this lines to your [[commands.conf]]:
 
  # add this lines to your [[commands.conf]]:
Zeile 18: Zeile 18:
 
   INFOSAT_OUT="/tmp/received_data" # store infosatepg in
 
   INFOSAT_OUT="/tmp/received_data" # store infosatepg in
 
   CHANNEL="VIVA"                  # which channel, e.g: <NUM> or <NAME>
 
   CHANNEL="VIVA"                  # which channel, e.g: <NUM> or <NAME>
  SYMBOL="|"                      # e.g: <|> or <#>
 
 
  # CONFIG END
 
  # CONFIG END
 
   
 
   
Zeile 36: Zeile 35:
 
         PID=\$!
 
         PID=\$!
 
         until ! ps -p \${PID} >/dev/null ; do
 
         until ! ps -p \${PID} >/dev/null ; do
             if [ -s "${INFOSAT_OUT}/status" -a "${1}" ] ; then
+
             if [ "${1}" ] ; then
                 STATUS=\$(gawk '/^[0-9]:/ { gsub("/"," ") ; W4 = W4 + \$4 ; W5 = W5 + \$5 } END { printf "%d\n", W4*100/W5 }' < "${INFOSAT_OUT}/status")
+
                 STATUS=\$(grep -s [0-9]% "${INFOSAT_OUT}/status"|tail -n 1)
                 > "${INFOSAT_OUT}/status"
+
                 eval \${STATUS:+svdrpsend.pl MESG "\${STATUS}"}
                GAUGE=\$(perl -l -e "printf '${SYMBOL}' x \$((\${STATUS:-0}*2/10))")
+
                svdrpsend.pl MESG "infosatepg status ~ \${STATUS:-0}% \$(printf "%-21s%-0s\n" "[\${GAUGE:-${SYMBOL}}" "]")"
+
 
             fi
 
             fi
             sleep 15s
+
             sleep 30s
 
         done
 
         done
         if grep -qs "^Finished reception" "${INFOSAT_OUT}/status" ; then
+
         if grep -qs complete "${INFOSAT_OUT}/status" ; then
 
             svdrpsend.pl MESG "infosatepg done..."
 
             svdrpsend.pl MESG "infosatepg done..."
 
         fi
 
         fi

Version vom 11. Februar 2005, 09:38 Uhr

#!/bin/sh
#
# infosatepg.sh - v.0.5
#
# add this lines to your commands.conf:
# folgende zeilen in die commands.conf eintragen:
#
# Run infosatepg                  : /usr/local/bin/infosatepg.sh
# Run infosatepg (inc osd status) : /usr/local/bin/infosatepg.sh -status
#
# Edit the config.pl:
#
# - our $infosaturl="/video/received_data";
# + our $infosaturl="/tmp/received_data";

# CONFIG START
  INFOSAT_OPT="-v"                 # options
  INFOSAT_OUT="/tmp/received_data" # store infosatepg in
  CHANNEL="VIVA"                   # which channel, e.g: <NUM> or <NAME>
# CONFIG END

PATH=$PATH:/usr/local/bin

if [ "$(ps axc|awk "{if (\$5==\"infosatepg\") print \$1}")" ] ; then
    echo "infosatepg is always running..."
else
    at now <<EOF
    svdrpsend.pl CHAN ${CHANNEL}|grep -e '^250.*'
    if [ ! \$? -eq 0 ] ; then
        sleep 2s
        svdrpsend.pl MESG "switch to ${CHANNEL} failed..."
    else
        mkdir -p "${INFOSAT_OUT}"
        infosatepg ${INFOSAT_OPT} -o "${INFOSAT_OUT}" > "${INFOSAT_OUT}/status" &
        PID=\$!
        until ! ps -p \${PID} >/dev/null ; do
            if [ "${1}" ] ; then
                STATUS=\$(grep -s [0-9]% "${INFOSAT_OUT}/status"|tail -n 1)
                eval \${STATUS:+svdrpsend.pl MESG "\${STATUS}"}
            fi
            sleep 30s
        done
        if grep -qs complete "${INFOSAT_OUT}/status" ; then
            svdrpsend.pl MESG "infosatepg done..."
        fi
    fi
EOF
fi