amassidda
Meister
- Registriert
- 30. Mai 2010
- Beiträge
- 821
- Reaktionspunkte
- 394
- Punkte
- 123
AW: Überwachung Cardok - Watchdog für Überwachung Oscam läuft
Hallo Leute
Habe da noch fragen an dem Script
Bei mir geht meine Tivusat Karte öffters mal in timeout aber bleibt auf Card OK. Macht ja nix da man ja mit dem Script auch Timeouts als Error Meldung nehmen kann.
Nun die Frage.
Stimmt die Config so:
Und woran erkenne ich ob es funktioniert.
In meinem Log von IPC steht zwar das es ausgeführt wird aber es ist schon passiert das die Tivusat Karte timeouts gebracht hat aber nichts passiert ist. Musste also meinen Reader selbst disabeln und enabeln.
Vielen dank für Hilfe im voraus
gruß
amassidda
Hallo Leute
Habe da noch fragen an dem Script
Bei mir geht meine Tivusat Karte öffters mal in timeout aber bleibt auf Card OK. Macht ja nix da man ja mit dem Script auch Timeouts als Error Meldung nehmen kann.
Nun die Frage.
Stimmt die Config so:
Code:
#!/bin/bash
#
#### CONFIG - START
## OScam WebIf with SSL? [1=yes , 0=no]
OSssl="0"
## /path/to/oscam.conf?
OScfg="/var/etc/oscam.conf"
## Cards to monitor
CARD["1"]="tivusat"
CARD["2"]="hd+"
## monitoring Error message (%CARDNAME% gets replaced by the script (its a placeholder!))
## multible error messages possible, simple add for each an own array
OSerror["1"]="tivusat .* timeout (2001 ms) by tivusat"
OSerror["2"]="tivusat .* ERROR, function call reader->crdr.receive(reader, data, size, delay, timeout) returns error."
Oserror["3"]="tivusat .* Resync error: readtimeouts 0/0 (max/min) us, writetimeouts 0/0 (max/min) us"
OSerror["4"]="tivusat .* card initializing error"
OSerror["5"]="tivusat .* Input/output error"
OSerror["6"]="tivusat .* timeout (2002 ms) by tivusat"
## OScam's Logfile?
OSlog="/var/log/oscam.log"
## reporting logfile for this script?
OStolog="/var/log/oscam.error"
#### CONFIG - END
OSip="127.0.0.1"
[ "$OSssl" = 1 ] && URL="https://" || URL="http://"
# Simple URL encoding
proc_url_encode() {
out=${1//%/%25}; out=${out//\{/%7B}; out=${out//\}/%7D}; out=${out//|/%7C};
out=${out//\\/%5C}; out=${out//^/%5E}; out=${out//~/%7E}; out=${out//[/%5B};
out=${out//]/%5D}; out=${out//\`/%60}; out=${out//#/%23}; out=${out//>/%3E};
out=${out//\$/%24}; out=${out//&/%26}; out=${out//+/%2B}; out=${out//,/%2C};
out=${out//\//%2F}; out=${out//:/%3A}; out=${out//;/%3B}; out=${out//=/%3B};
out=${out//\?/%3F}; out=${out// /%20}; out=${out//</%3C};
out=${out//\!/%21}; out=${out//\"/%22}; out=${out//\@/%40}; out=${out//\'/%27};
out=${out//\(/%28}; out=${out//\)/%29}; out=${out//\*/%2A}; out=${out//\-/%2D};
out=${out//\_/%5F}; out=${out//\./%2E}; out=${out//\./%80};
echo $out
}
proc_parse_cfg() {
i=0
while read line; do
line=$(echo $line | sed -e 's/ //g')
if [[ "$line" =~ ^[^#]*= ]]; then
cfg_name[$i]=$(echo $line | cut -d'=' -f 1)
cfg_value[$i]=$(echo $line | cut -d'=' -f 2-)
((++i))
fi
done < $1
}
get_cfg_value() {
i=0
for name in ${cfg_name[@]}; do
[ "$1" = "$name" ] && echo "${cfg_value[$i]}" && break
((++i))
done
}
proc_get_infos() {
proc_parse_cfg $OScfg
WEBPORT=$(get_cfg_value httpport)
[ -z "$WEBPORT" ] && "ERROR: WebIf isnt enabled! Abort!" && exit 1
if [[ "$WEBPORT" =~ "\+" ]]; then
URL="https://"
WEBPORT=$(echo $WEBPORT | tr -d '+')
fi
USERNAME=$(get_cfg_value httpuser)
if [ ! -z "$USERNAME" ]; then
PASSWORD=$(get_cfg_value httppwd)
URL="$URL"`proc_url_encode "${USERNAME}"`":"`proc_url_encode "${PASSWORD}"`"@${OSip}:${WEBPORT}"
else
URL="${URL}$OSip:$WEBPORT"
fi
}
proc_get_infos
for card in "${CARD[@]}" ; do
for idx in "${!OSerror[@]}" ; do
Em=${OSerror[$idx]}
ERRORmsg=${Em//%CARDNAME%/$card}
founds=`tail -10 $OSlog | grep "$ERRORmsg" | wc -l`
if [ $founds -gt 0 ]; then
echo "`date +%d-%b-%Y` `date +%H:%M:%S`: $card Card lost" >> $OStolog
curl -s --digest "$URL/readers.html?label=${card}&action=disable" >/dev/null
curl -s --digest "$URL/readers.html?label=${card}&action=enable" >/dev/null
fi
done
done
exit 0
In meinem Log von IPC steht zwar das es ausgeführt wird aber es ist schon passiert das die Tivusat Karte timeouts gebracht hat aber nichts passiert ist. Musste also meinen Reader selbst disabeln und enabeln.
Vielen dank für Hilfe im voraus
gruß
amassidda