Resolved it by configuring retropie to boot to the command line and then i'll edit .bashrc to house the if logic to launch X or ES depending on TOD and of course
if [ "`tty`" = "/dev/tty1" ]
Was much easier than I was trying to make it...
#####
# Set the hours between which PiClock will Launch
####
minHour=6
maxHour=9
#Get Current Hour
cHour=$(date +%H)
# Get current time and time of boot.
# calculate minutes since boot
cSec=$(date +%s)
sSec=$(date +%s -d "$(uptime -s)")
uMin=$(( ($cSec - $sSec)/60 ))
# Ensure that we are within 2 minutes of boot. This ensures that user can exit ES to the command line
# without this script re-launching ES in an endless loop
if [[ $uMin -le 2 ]]; then
# Ensure this is tty1
if [[ "`tty`" = "/dev/tty1" ]]; then
# If between min and max hour then startx and PiClock else execute autorun
if [[ $cHour -ge $minHour && $cHour -lt $maxHour ]]; then
startx
else
bash "/opt/retropie/configs/all/autorun.sh"
fi
fi
fi
The issue I see is trying to drop to the command line from ES in which case I believe it will just launch back into ES... i'm ok with this. Maybe some other unintended consequences but I'll find out soon enough.
Edit: Added an additional If statement to check for minutes since boot so that one can successfully drop from ES to the CL without