#!/bin/sh
OFFSET=10
if [ ! -f /var/run/mythtv/mythbackend.pid ]
then
	exit 0
fi
if [ `pgrep -c mythbackend` -ne 0 ]
then
	exit 0
fi
pkill -9 -u mythtv
for ADAPTER in 0 1 2 3
do
	NEW_ADAPTER=`expr $ADAPTER + $OFFSET`
        umount /dev/dvb/adapter$NEW_ADAPTER
	if [ $? -eq 0 ]
	then
		nice --4 /usr/local/bin/fuse_b25 --target /dev/dvb/adapter$ADAPTER /dev/dvb/adapter$NEW_ADAPTER -o allow_other
	fi
done
/etc/init.d/mythtv-backend restart
