#!/bin/bash
echo " Timer Install Script...."
while true 
do 
	if [ -f "/home/root/b110_update.tar" ]; then
		if [[ `fuser /home/root/b110_update.tar 2> /dev/null | wc -w` == 0 ]] ; then
			echo " New Install File Ready"
			echo 1 > /var/tmp/new_update_file
			sleep 5 
			sync
			cd /home/root
			chmod +x install.sh
			./install.sh
			exit
		else
			echo " Copying New Install File "
		fi
	else
		sleep 5 
	fi
done
