qstream-iptv 1.04 KB
Newer Older
oak's avatar
oak committed
1
2
3
4
5
6
7
8
9
10
#!/bin/bash

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

y=`date +%Y`
m=`date +%m`
d=`date +%d`
h=`date +%H`


Olav Kvittem's avatar
Olav Kvittem committed
11
tv=/var/lib/qstream/data/iptv
oak's avatar
oak committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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

# tmp=$tv/data/tmp/$$
# test -d $tmp || mkdir $tmp

cd $ddir

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

while read kanal mcaddr opt rest; do

  echo $kanal | egrep -q '^\s*#'
  if test $? = 1 ; then # no comment
     log=`echo $kanal | sed -e 's/ /_/g'`
     xml=$log.`date +%T`.xml

     /usr/bin/qstream -name "$kanal" -xml "$xml" -q -last 10 -nperiod 1 -net $opt $mcaddr >> $log.log  2>>$log.error
     if test $? != 0 ; then  # possible error - add CR
	 echo >> $log.log
     fi
     /usr/bin/qstream-check-bb -bb 158.38.130.84 "$xml" 
     if test ! -s $log.log ; then rm $log.log ; fi
     if test ! -s $log.error ; then rm $log.error ; fi
  fi
done