#!/bin/sh

# Run this between 1AM-2AM, night time
while [ 1 ] ; do
	TIME_TO_START_SCAN=$(date | grep " 01:")
	if [ "$TIME_TO_START_SCAN" != "" ]; then
		break
	fi
	sleep 3000
done

while [ 1 ] ; do
	# cleanup just in case if the scan is still running
	killall scanpartitions
	
	# run the scan iteration in backround
	/bin/scanpartitions &
	
	#sleep for one day in parallel, so we can start exactly the same time next day
	sleep 86400
done

