I have a script that depends on X server is started. So in the script, I check if X is started with the while loop below:
while xset q; do
sleep 1
done
Everything works well if I run this script manually. But if it's started from rc.local during system start, it sticks in the loop.
How to check if X is started in the script under rc.local?