if [ $(tty) == "/dev/tty1" ]; then
    while true
	do
		startx
		echo "X session ended, restarting..."
		sleep 5
	done
fi