Infosatepg.sh

Aus VDR Wiki
Wechseln zu: Navigation, Suche
#!/bin/sh
#
# infosatepg.sh - v.0.2
#
# 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";
#
# history
# --------
# 20050113,ronny: added osd status

# CONFIG START
  INFOSAT_OPT="-c VIVA -v"         # Options
  INFOSAT_OUT="/tmp/received_data" # Store infosatepg in...
# CONFIG END

PATH=$PATH:/usr/local/bin

test "$(ps axc|awk "{if (\$5==\"infosatepg\") print \$1}")" && {
    echo 'infosatepg is always running ?'
    exit 1
}
 
mkdir -p "${INFOSAT_OUT}"
 
at now <<EOF
infosatepg ${INFOSAT_OPT} -o "${INFOSAT_OUT}" > "${INFOSAT_OUT}/status" &
PID=\$!
test "${1}" && {
    until ! ps -p \${PID} >/dev/null ; do
        test -s "${INFOSAT_OUT}/status" && {
            STATUS=\$(gawk '/^[0-9]:/ { gsub("/"," ") ; W4 = W4 + \$4; W5 = W5 + \$5 } END { printf "%d\n", W4*100/W5 }' < "${INFOSAT_OUT}/status")
            GAUGE=\$(perl -l -e "printf '#' x \$((\${STATUS}*2/10))")
            svdrpsend.pl MESG "infosatepg status ~ \${STATUS}% \$(printf "%-21s%-0s\n" "[\${GAUGE:-#}" "]")"
        }
        sleep 15s
    done
}
EOF