c=1

stopfile=/data/seestats/stop_lt
runfile=/data/seestats/run_st

while [ 1 ]
do

	if [ -f "$runfile" ]
	then
		echo "$runfile found."
		echo "Waiting for short term session to end ..."
		sleep 60

	else 	
	
		echo "---------------"
		echo "Long term $c times" $(date +%s) $(date)  

		# 15 mins
		# Trying to be on the conservative side.
		# <Needs Testing>: Hoping that the utility gets a chance to be called 
		# amidst suspend events. 
		sleep 900  


		# Idea is to club things together, spreading utilities may not be a good idea.
		# That is why we call scripts sets one after another. 	
		/data/seestats/scripts_set1.sh		
		/data/seestats/scripts_set2.sh
		/data/seestats/systemcheck.sh



		if [ -f "$stopfile" ]
		then
			echo "$stopfile found."
			break
		fi

		(( c++ ))
	fi

done
