I have the following cronjobs:
At 18:30 display-off.sh
At 03:00 sudo reboot (I want a nightly reboot to make sure everything keeps running smoothly)
At 03:10 display-off.sh (because we just rebooted)
At 08:30 display-on.sh
Every morning I see that the kiosks are booted into the raspi-config tty instead of Xorg (The graphical environment). I have done some debugging and believe this is happening:
If I open a console on the raspi-config tty and run the following:
./display-off.sh; sleep 60; ./display-on.sh
the display turns off and back on after 60 seconds, but on the graphical tty instead of the console tty from which I launched this set of commands.
Then if I go back to that console tty and run:
sleep 10; ./display-off.sh; sleep 60; ./display-on.sh
and quickly switch to the graphical tty before sleep 10
finishes the following happens:
The display turns off and back on after 60 seconds, but this time on the graphical tty instead of the console tty.
This leads me to believe that display-on is not functioning correctly and always switches to the opposite tty that was active when display-on is being executed. So when rebooting at 03:00 AM the graphical tty becomes active. Then at 03:10 the display is turned of, but the graphical tty stays active (without an active monitor of course). Then at 08:30 display-on is being executed but it switches to the console tty, because the graphical tty was active at that time.
I think this might be related to: #30 (comment)
My current workaround is the following:
Turn of display at 18:30
Reboot at 08:30, which also turns on the display and opens the graphical tty by default.