How to poll for Xvfb to be ready?
By default Xvfb
will create a Unix Domain socket for clients to connect. On my system this file socket file is created in /tmp/.X11-unix/
. You could use inotifywait
to listen for events in this directory. For example,
$ inotifywait -e create /tmp/.X11-unix/
and then run Xvfb :9
(display 9, for example). When it is ready you should see
/tmp/.X11-unix/ CREATE X9
from the inotifywait
which will terminate. You should now be able to connect to DISPLAY=:9
.