Infosatepg.sh

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
 
(39 dazwischenliegende Versionen von 20 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
#!/bin/sh
+
Vorschlag für ein einfaches Skript um [[infosatepg]] zu'' starten'', welches über die [[commands.conf]] ausgeführt werden kann.
#
+
# 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:-0}*2/10))")
+
            svdrpsend.pl MESG "infosatepg status ~ \${STATUS}% \$(printf "%-21s%-0s\n" "[\${GAUGE:-#}" "]")"
+
        }
+
        sleep 15s
+
    done
+
}
+
EOF
+
  
[[Kategorie:Scripts]]
+
{{Box Datei | [[Struktur|$PATH]]/infosatepg.sh |
 +
<pre>
 +
#!/bin/sh
 +
#
 +
# infosatepg.sh
 +
#
 +
# Required: screen, svdrpsend.pl, infosatepg, tvm2vdr.pl (optional)
 +
#
 +
# add this lines to your commands.conf:
 +
# folgende zeilen in die commands.conf eintragen:
 +
#
 +
# Run infosatepg              : /path_to_this_script/infosatepg.sh start
 +
# Run infosatepg + tvmovie2vdr : /path_to_this_script/infosatepg.sh start +
 +
# Status                      : /path_to_this_script/infosatepg.sh status
 +
#
 +
# Edit the config.pl:
 +
#
 +
# - our $infosaturl="/video/received_data";
 +
# + our $infosaturl="/usr/local/cache/infosatepg";
 +
 
 +
# CONFIG START
 +
  INFOSATEPGOPT="-v"                          # infosatepg options
 +
  CHANNEL="TechniSat Kanal 50"                # which channel, e.g: <NUM> or <NAME>
 +
  NEWC="TechniSat Kanal 50;TechniSat:12670:vC56:S19.2E:22000:1537:0:0:0:12818:1:1116:0"
 +
  CLEANUP="10"                                # cleanup files (older n*24 hours ago)
 +
  INFOSATEPGOUT="/usr/local/cache/infosatepg"  # store infosatepg in
 +
  TVMOVIE2VDRDIR="${SOURCEDIR:?}/tvmovie2vdr"  # tvmovie2vdr directory
 +
  TVMOVIE2VDROPT=""                            # tvmovie2vdr options (tvim2vdr.pl -help)
 +
  LOGFILE="/var/log/vdr/infosatepg.log"        # logfile
 +
# CONFIG END
 +
 
 +
# cleanup old images
 +
find "$INFOSATEPGOUT" -follow -type f -mtime +${CLEANUP:-100} -exec rm {} \;
 +
 
 +
case $1 in
 +
    start)
 +
if screen -ls | egrep -q infosatepg ; then
 +
    echo "infosatepg is already running..."
 +
else
 +
    screen -dmS infosatepg sh -x -c "( \
 +
    svdrpsend.pl -p ${VDR_PORT:-2001} \"$NEWC\" ; \
 +
    infosatepg $INFOSATEPGOPT -c \"$CHANNEL\" -o \"$INFOSATEPGOUT\" ; \
 +
    if [ -n \"$2\" ] ; then \
 +
cd \"$TVMOVIE2VDRDIR\" ; \
 +
./tvm2vdr.pl $TVMOVIE2VDROPT ; \
 +
    fi \
 +
    ) > \"$LOGFILE\" 2>&1"
 +
fi
 +
;;
 +
    status)
 +
screen -ls | egrep -c infosatepg
 +
;;
 +
    *)
 +
echo "Usage: $0 {start|status}" >&2
 +
        exit 1
 +
esac
 +
 
 +
exit $?
 +
</pre>
 +
}}
 +
 
 +
==Quellen==
 +
* [[tvmovie2vdr]]
 +
 
 +
[[Kategorie:Skripte]]

Aktuelle Version vom 4. Juni 2006, 09:43 Uhr

Vorschlag für ein einfaches Skript um infosatepg zu starten, welches über die commands.conf ausgeführt werden kann.

Datei
$PATH/infosatepg.sh
#!/bin/sh
#
# infosatepg.sh
#
# Required: screen, svdrpsend.pl, infosatepg, tvm2vdr.pl (optional)
#
# add this lines to your commands.conf:
# folgende zeilen in die commands.conf eintragen:
#
# Run infosatepg               : /path_to_this_script/infosatepg.sh start
# Run infosatepg + tvmovie2vdr : /path_to_this_script/infosatepg.sh start +
# Status                       : /path_to_this_script/infosatepg.sh status
#
# Edit the config.pl:
#
# - our $infosaturl="/video/received_data";
# + our $infosaturl="/usr/local/cache/infosatepg";

# CONFIG START
  INFOSATEPGOPT="-v"                           # infosatepg options
  CHANNEL="TechniSat Kanal 50"                 # which channel, e.g: <NUM> or <NAME>
  NEWC="TechniSat Kanal 50;TechniSat:12670:vC56:S19.2E:22000:1537:0:0:0:12818:1:1116:0"
  CLEANUP="10"                                 # cleanup files (older n*24 hours ago)
  INFOSATEPGOUT="/usr/local/cache/infosatepg"  # store infosatepg in
  TVMOVIE2VDRDIR="${SOURCEDIR:?}/tvmovie2vdr"  # tvmovie2vdr directory
  TVMOVIE2VDROPT=""                            # tvmovie2vdr options (tvim2vdr.pl -help)
  LOGFILE="/var/log/vdr/infosatepg.log"        # logfile
# CONFIG END

# cleanup old images
find "$INFOSATEPGOUT" -follow -type f -mtime +${CLEANUP:-100} -exec rm {} \;

case $1 in
     start)
	if screen -ls | egrep -q infosatepg ; then
	    echo "infosatepg is already running..."
	else
	    screen -dmS infosatepg sh -x -c "( \
	    svdrpsend.pl -p ${VDR_PORT:-2001} \"$NEWC\" ; \
	    infosatepg $INFOSATEPGOPT -c \"$CHANNEL\" -o \"$INFOSATEPGOUT\" ; \
	    if [ -n \"$2\" ] ; then \
		cd \"$TVMOVIE2VDRDIR\" ; \
		./tvm2vdr.pl $TVMOVIE2VDROPT ; \
	    fi \
	    ) > \"$LOGFILE\" 2>&1"
	fi
	;;
     status)
	screen -ls | egrep -c infosatepg
	;;
     *)
	echo "Usage: $0 {start|status}" >&2
        exit 1
esac

exit $?


[Bearbeiten] Quellen