Hallo zusammen,
aus diesem Thread und aus der Readme von cimon hab mir folgendes Script geschrieben, das mir den FLI4L von vdr aus steuern lässt, und entsprechende OSD-Meldungen anzeigt. Ganz nützlich bei einem Fli4l-Router im Netz, der auf manuelle Anwahl gesetzt ist. Nützlich z.B. für EPG-Downloads. Aufruf per shell oder commands.conf: cimonvdr{showstatus|dial|hangup}
Aktuelles Skript:
Bash
#!/bin/bash
#
# Name: cimonvdr
# Date: 050424 by Andreas Baierl [EMAIL]ichgeh@imkreisrum.de[/EMAIL]
# Title: Script to communicate from vdr to a fli4l
#
# Purpose: My vdr is connected to a fli4l-router which act like a gateway.
# My fli4l is not in auto-mode, but in manual dial mode because of some PCs
# that dial in whenever they want.
# So I have to dial in manually for updating epg for example.
#
# required programs:
# - cimon (Rene Harmann) from [URL]www.fli4l.de/german/addons.htm[/URL]
# - svdrpsend.pl to display the OSD-messages
# - at
# - dos2unix
#
# Usage: 1. Fit the variables to your system
# 2. command: cimonvdr {showstatus|dial|hangup}
# 3. perhaps edit your commands.conf like this:
# fli4l-status: echo "/usr/bin/cimonvdr status" | at -q t now
# fli4l-dial: echo "/usr/bin/cimonvdr dial" | at -q t now
# fli4l-hangup: echo "/usr/bin/cimonvdr hangup" | at -q t now
# 4. Your router should do something, and some OSD-messages should appear
#
# change variables
ROUTER=fli4l # DNS oder IP des Routers
SVDRPSEND=/usr/bin/svdrpsend.pl # Pfad zu svdrpsend.pl
CHANNEL=1 # ISDN Kanal
CIMON=/usr/bin/cimon # Pfad zu cimon
DOS2UNIX=/usr/bin/dos2unix # Pfad zu dos2unix
# do not edit
STATUS=`$CIMON $ROUTER status $CHANNEL | $DOS2UNIX` && echo $STATUS
i=0
case $1 in
showstatus)
while STATUS=`$CIMON $ROUTER status $CHANNEL | $DOS2UNIX` && [ "$STATUS" = "OK Calling" ] && $i<10 ; do
sleep 1
let i = i + 1
done
if STATUS=`$CIMON $ROUTER status $CHANNEL | $DOS2UNIX` && [ "$STATUS" = "OK Online" ]; then
echo "$SVDRPSEND MESG 'Router is online' >/dev/null" | at now
# echo "Router is online"
else
echo "$SVDRPSEND MESG 'Router is offline' >/dev/null" | at now
# echo "Router is offline"
fi
;;
dial)
if STATUS=`$CIMON $ROUTER status $CHANNEL | $DOS2UNIX` && [ "$STATUS" = "OK Offline" ]; then
$CIMON $ROUTER dial
# echo "Dialing..."
echo "$SVDRPSEND MESG 'Dialing...' >/dev/null" | at now
while STATUS=`$CIMON $ROUTER status $CHANNEL | $DOS2UNIX` && [ "$STATUS" = "OK Calling" ]; do
sleep 1
done
if STATUS=`$CIMON $ROUTER status $CHANNEL | $DOS2UNIX` && [ "$STATUS" = "OK Online" ]; then
# echo "Router is online now"
echo "$SVDRPSEND MESG 'Router is online now' >/dev/null" | at now
else
# echo "Dialing failed!"
echo "$SVDRPSEND MESG 'Dialing failed!' >/dev/null" | at now
fi
elif STATUS=`$CIMON $ROUTER status $CHANNEL | $DOS2UNIX` && [ "$STATUS" = "OK Online" ]; then
# echo "Router already online..."
echo "$SVDRPSEND MESG 'Router already online...' >/dev/null" | at now
else
# echo "Connection to Router failed!"
echo "$SVDRPSEND MESG 'Connection to Router failed!' >/dev/null" | at now
fi
;;
hangup)
if STATUS=`$CIMON $ROUTER status $CHANNEL | $DOS2UNIX` && [ "$STATUS" = "OK Online" ]; then
$CIMON $ROUTER hangup
# echo "Hanging up..."
echo "$SVDRPSEND MESG 'Hanging up...' >/dev/null" | at now
sleep 3
if STATUS=`$CIMON $ROUTER status $CHANNEL | $DOS2UNIX` && [ "$STATUS" = "OK Offline" ]; then
echo "$SVDRPSEND MESG 'Router is offline now' >/dev/null" | at now
else
echo "$SVDRPSEND MESG 'Hanging up failed' >/dev/null" | at now
echo "$SVDRPSEND MESG '$STATUS' >/dev/null" | at now
fi
elif STATUS=`$CIMON $ROUTER status $CHANNEL | $DOS2UNIX` && [ "$STATUS" = "OK Offline" ]; then
# echo "Router already offline..."
echo "$SVDRPSEND MESG 'Router already offline...' >/dev/null" | at now
else
# echo "Connection to Router failed!"
echo "$SVDRPSEND MESG 'Connection to Router failed!' >/dev/null" | at now
fi
;;
*)
echo "Usage: cimonvdr {showstatus|dial|hangup}" >&2
exit 1
;;
esac
exit 0
Alles anzeigen
Erweiterung und Kritik jederzeit erwünscht.
Danke und Gruß,
Andreas