#!/bin/bash
echo " Main Restart Script...."
sleep 5
while true 
do 
	sleep 2
	if [ -f "/home/root/b110_update.tar" ]; then
		exit
	else
		if pgrep b110_main > /dev/null 
		then
			:
		else
			if [ -f "/home/root/b110_update.tar" ]; then
				exit
			else
			  echo "b110_main stopped -> restart"
			  sleep 2
			  cd /var/tmp
			  killall b110_main > /dev/null
			  ./b110_main > /dev/null&
			 fi
		fi
	fi
done
