You need to wrap the command
xvfb-run. However, in gitbook (
ebook-convert is called directly.
You may change gitbook to call
xvfb-run ebook-convert. However, when you upgrade gitbook, you lost the change.
My solution is to add this wrapper so that calling
ebook-convert is actually invoking this wrapper:
/usr/local/bin/ is before
/usr/bin/ in my $PATH):
echo "Run xvfb-run /usr/bin/ebook-convert $@"
xvfb-run /usr/bin/ebook-convert "$@"