#!/bin/bash
echo starting at `date` >> /var/log/tvm2vdr.log
sleep 5

/etc/init.d/ntp-client stop >> /var/log/tvm2vdr.log
/etc/init.d/ntp-client start >> /var/log/tvm2vdr.log

mkdir /video/epgimages > /dev/null 2>&1
cd /etc/vdr/tvmovie2vdr
# start tvmovie2vdr
./tvm2vdr.pl >> /var/log/tvm2vdr.log

# clear old timer for vdr < 1.3.23
./clearoldtimer.pl

# cleanup old images
find /video/epgimages/ -type f  -mtime +10 -exec rm {} \;

# shutting down
if [ q"$1" == qpowerdown ]; then
	echo stopping and shutting down at `date` >> /var/log/tvm2vdr.log
	/usr/bin/svdrpsend.pl hitk power
fi
