Created
March 13, 2015 17:24
-
-
Save charterchap/b571104dc6c27547e443 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I had a problem today where trying to load things into an Xvfb was not working because the xvfb | |
# was not yet initialized. The problem script is as follows: | |
# Start the Xvfb on DISPLAY :1, | |
`dirname $0`/Xvfb :1 -screen 0 1280x1024x24 -ac -br -fbdir /dev/shm & xvfbpid=$! | |
DISPLAY=:1 xli -onroot -fillscreen `dirname $0`/images/background.png | |
# The only solution I see on the web is to insert a sleep statement. | |
# I don't much like that. The solution I came up with is to wait for the display to be ready to use via xdpyinfo. | |
# The working script: | |
# Start the Xvfb on DISPLAY :1, | |
`dirname $0`/Xvfb :1 -screen 0 1280x1024x24 -ac -br -fbdir /dev/shm & xvfbpid=$! | |
# Wait for Xvfb to initialize | |
ACTIVE=9999 | |
while [ $ACTIVE -ne 0 ] ; do | |
xdpyinfo -display :1 &> /dev/null | |
ACTIVE=$? | |
done | |
DISPLAY=:1 xli -onroot -fillscreen `dirname $0`/images/background.png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment