Skip to content

Instantly share code, notes, and snippets.

@thomas-p-wilson
Last active August 17, 2018 11:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomas-p-wilson/86efe87c387ed7f2a81f to your computer and use it in GitHub Desktop.
Save thomas-p-wilson/86efe87c387ed7f2a81f to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Originally found at https://github.com/mark-adams/docker-chromium-xvfb/blob/master/images/base/xvfb-chromium
# and modified to work with google-chrome instead of chromium
_kill_procs() {
kill -TERM $chrome
wait $chrome
kill -TERM $xvfb
}
# Setup a trap to catch SIGTERM and relay it to child processes
trap _kill_procs SIGTERM
XVFB_WHD=${XVFB_WHD:-1280x720x16}
# Start xvfb
Xvfb :99 -ac -screen 0 $XVFB_WHD -nolisten tcp &
xvfb=$!
export DISPLAY=:99
google-chrome --no-sandbox $@ &
chrome=$!
wait $chrome
wait $xvfb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment