Infosatepg.sh
Aus VDR Wiki
(Unterschied zwischen Versionen)
Zeile 1: | Zeile 1: | ||
#!/bin/sh | #!/bin/sh | ||
# | # | ||
− | # infosatepg.sh - v.0. | + | # infosatepg.sh - v.0.2 |
# | # | ||
− | # add this | + | # add this lines to your [[commands.conf]]: |
− | # folgende | + | # folgende zeilen in die [[commands.conf]] eintragen: |
# | # | ||
− | # Run infosatepg : /usr/local/bin/infosatepg.sh | + | # Run infosatepg : /usr/local/bin/infosatepg.sh |
+ | # Run infosatepg (inc osd status) : /usr/local/bin/infosatepg.sh status | ||
# | # | ||
# Edit the config.pl: | # Edit the config.pl: | ||
Zeile 12: | Zeile 13: | ||
# - our $infosaturl="/video/received_data"; | # - our $infosaturl="/video/received_data"; | ||
# + our $infosaturl="/tmp/received_data"; | # + our $infosaturl="/tmp/received_data"; | ||
+ | # | ||
+ | # history | ||
+ | # -------- | ||
+ | # 20050113,ronny: added osd status | ||
# CONFIG START | # CONFIG START | ||
− | INFOSAT_OPT="-c VIVA" | + | INFOSAT_OPT="-c VIVA -v" # Options |
INFOSAT_OUT="/tmp/received_data" # Store infosatepg in... | INFOSAT_OUT="/tmp/received_data" # Store infosatepg in... | ||
# CONFIG END | # CONFIG END | ||
Zeile 24: | Zeile 29: | ||
exit 1 | exit 1 | ||
} | } | ||
− | + | ||
mkdir -p "${INFOSAT_OUT}" | mkdir -p "${INFOSAT_OUT}" | ||
− | + | ||
at now <<EOF | at now <<EOF | ||
− | infosatepg ${INFOSAT_OPT} -o "${INFOSAT_OUT}" | + | 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") | ||
+ | case \${#STATUS} in | ||
+ | 1) GAUGE="#" ;; | ||
+ | 2) GAUGE=\$(perl -l -e "printf \"#\" x \${STATUS:0:1}") ;; | ||
+ | esac | ||
+ | svdrpsend.pl MESG "infosatepg status ~ \${STATUS}% \$(printf "%-11s%-0s\n" "[\${GAUGE}" "]")" | ||
+ | } | ||
+ | sleep 15s | ||
+ | done | ||
+ | } | ||
EOF | EOF | ||
[[Kategorie:Scripts]] | [[Kategorie:Scripts]] |
Version vom 13. Januar 2005, 05:02 Uhr
#!/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") case \${#STATUS} in 1) GAUGE="#" ;; 2) GAUGE=\$(perl -l -e "printf \"#\" x \${STATUS:0:1}") ;; esac svdrpsend.pl MESG "infosatepg status ~ \${STATUS}% \$(printf "%-11s%-0s\n" "[\${GAUGE}" "]")" } sleep 15s done } EOF