qstream-tv 947 Bytes
Newer Older
1 2
#!/bin/bash

3 4
ulimit -c unlimited  # for debugging of hangup problem og qstream

5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
y=`date +%Y`
m=`date +%m`
d=`date +%d`
h=`date +%H`


tv=/var/lib/qstream/data/tv
ydir=$tv/$y
test -d $ydir || mkdir $ydir
mdir=$ydir/$m
test -d $mdir || mkdir $mdir
ddir=$mdir/$d
test -d $ddir || mkdir $ddir
#hdir=$ddir/$h
#test -d $hdir || mkdir $hdir

21 22 23
tmpdir=$tv/tmp
test -d $tmpdir || mkdir $tmpdir
tmp=$tmpdir/qstream-$$
24 25 26 27 28 29 30 31 32 33 34 35

cd $ddir

export IFS=";"
# export MALLOC_CHECK_=1   # write comprehensive error message when fail
ulimit -c 500000000

while read kanal mcaddr rest; do

  echo $kanal | egrep -q '^\s*#'
  if test $? = 1 ; then # no comment
     log=`echo $kanal | sed -e 's/ /_/g'`
36 37 38 39 40 41 42
     /usr/bin/qstream -format full -nohead -v -last 10 -net $mcaddr > $tmp.log  2>>$log.error
     if test $? = 0 ; then  # probably OK - keep data
	 cat $tmp.log >> $log.log
     else
	 cat $tmp.log >> $tmpdir/qstream.error
     fi
     echo >$tmp.log
43 44
  fi
done
45
rm $tmp.log