Skip to content

Instantly share code, notes, and snippets.

@davidhooey
Forked from jterrace/xvfb
Last active August 29, 2015 14:21
Show Gist options
  • Save davidhooey/f29c202d3c8f29e77087 to your computer and use it in GitHub Desktop.
Save davidhooey/f29c202d3c8f29e77087 to your computer and use it in GitHub Desktop.
Xfvb init script for ubuntu
# Installation
#
# 1. Install Xvfb
#
# sudo apt-get install xvfb
#
# 2. Add this file to /etc/init.d/xvfb
#
# 3. Make the script execuable.
#
# sudo chmod +x /etc/init.d/xvfb
#
# 4. Start, Stop, Restart
#
# sudo /etc/init.d/xvfb start
# sudo /etc/init.d/xvfb stop
# sudo /etc/init.d/xvfb restart
#
# 5. The script will start the virtual display at :10 so make sure
# to set your DISPLAY environment variable appropriately.
#
# export DISPLAY=:10
#
# 6. To auto start the serice.
#
# sudo update-rc.d xvfb defaults
XVFB=/usr/bin/Xvfb
XVFBARGS=":10 -screen 0 1366x768x24 -ac"
PIDFILE=/var/run/xvfb.pid
case "$1" in
start)
echo -n "Starting virtual X frame buffer: Xvfb"
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS
echo "."
;;
stop)
echo -n "Stopping virtual X frame buffer: Xvfb"
start-stop-daemon --stop --quiet --pidfile $PIDFILE
echo "."
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: /etc/init.d/xvfb {start|stop|restart}"
exit 1
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment