#!/bin/sh
#mintaj_gbox_stat_0.4 beta [optimization SifTeam image]
echo Use client Gbox`cat /tmp/mgstat.info | grep tuxbox | awk '{gsub(/,/," "); print " emu: " $2; print $3}'`
echo `cat /tmp/mgstat.info |awk '{ print $1}'` >>/tmp/domena.info
echo "You domain Gbox:"
echo `cat /var/keys/peer.cfg | grep M: |awk '{gsub(/,/," "); print " M: " $2; print $3; print $4; print $5; print $6}'`
echo "Use domain Gbox:"
echo `cat /tmp/domena.info |awk '{print $05}'` 
#Next domain ...
# echo `cat /tmp/domena.info |awk '{print $06}'`
# echo `cat /tmp/domena.info |awk '{print $07}'`
# echo `cat /tmp/domena.info |awk '{print $08}'`
# echo `cat /tmp/domena.info |awk '{print $09}'`
rm /tmp/domena.info
#Use script crash_Statystyka
SHINFO=/tmp/mg.info
PIDINFO=/tmp/pid.info
PEERS=/tmp/mg.info
ONLINE=`cat /tmp/mg.info |awk '{print $1}' |grep 1 |wc -l`
SECA=`cat /tmp/mg.info |awk '{print $6}' | cut -b -2 |grep 01 |wc -l`
VIA=`cat /tmp/mg.info |awk '{print $6}' | cut -b -2 |grep 05 |wc -l`
IRDETO=`cat /tmp/mg.info |awk '{print $6}' | cut -b -2 |grep 06 |wc -l`
CONAX=`cat /tmp/mg.info |awk '{print $6}' | cut -b -2 |grep 0B |wc -l`
CRYPTO=`cat /tmp/mg.info |awk '{print $6}' | cut -b -2 |grep 0D |wc -l`
BETA=`cat /tmp/mg.info |awk '{print $6}' | cut -b -2 |grep 17 |wc -l`
NAGRA=`cat /tmp/mg.info |awk '{print $6}' | cut -b -2 |grep 18 |wc -l`
DREAM=`cat /tmp/mg.info |awk '{print $6}' | cut -b -3 |grep 4A7 |wc -l`
NDS=`cat /tmp/mg.info |awk '{print $6}' | cut -b -2 |grep 09 |wc -l`

if [ -f $SHINFO ]
then
# ILEPROVIDER=
# echo "Providers:"$ILEPROVIDER

 ILECARDS=`cat $SHINFO | wc -l`
 ILEDIST1=`cat $SHINFO | grep dist:1 | wc -l`
 ILEDIST2=`cat $SHINFO | grep dist:2 | wc -l`
 ILEDIST3=`cat $SHINFO | grep dist:3 | wc -l`
 ILEDIST4=`cat $SHINFO | grep dist:4 | wc -l`
 ILEDIST5=`cat $SHINFO | grep dist:5 | wc -l`
 ILELEVEL4=`cat $SHINFO | grep Lev:0 | wc -l`
 ILELEVEL3=`cat $SHINFO | grep Lev:1 | wc -l`
 ILELEVEL2=`cat $SHINFO | grep Lev:2 | wc -l`
 ILELEVEL1=`cat $SHINFO | grep Lev:3 | wc -l`
 ILELEVEL0=`cat $SHINFO | grep Lev:4 | wc -l`
 ILELEVEL0=`cat $SHINFO | grep Lev:5 | wc -l`

 echo "All online cards -  "$ILECARDS
 echo " "
 echo " Cards the distance 1 -  "$ILEDIST1
 echo " Cards the distance 2 -  "$ILEDIST2
 echo " Cards the distance 3 -  "$ILEDIST3
 echo " Cards the distance 4 -  "$ILEDIST4
 echo " Cards the distance 5 -  "$ILEDIST5
 echo " "

 echo " Cards on the level 5 -  "$ILELEVEL5
 echo " Cards on the level 4 -  "$ILELEVEL4
 echo " Cards on the level 3 -  "$ILELEVEL3
 echo " Cards on the level 2 -  "$ILELEVEL2
 echo " Cards on the level 1 -  "$ILELEVEL1
 echo " Cards on the level 0 -  "$ILELEVEL0
 echo " "
 echo " Card SECA - "$SECA
 echo " Card VIA "$VIA
 echo " Card IRDETO - "$IRDETO
 echo " Card CONAX - "$CONAX
 echo " Card CRYPTO - "$CRYPTO
 echo " Card BETA - "$BETA
 echo " Card NAGRA - "$NAGRA
 echo " Card DREAM - "$DREAM
 echo " Card NDS - "$NDS
else
  echo " "
fi