diff --git a/xfvb.sh b/xfvb.sh
index a2984f9e6aa1b537e3a7f75dfe681ccf14ae1332..6b3523e107129c6dc12631d621b918f2f5e03896 100644
--- a/xfvb.sh
+++ b/xfvb.sh
@@ -1 +1,23 @@
-xvfb :99 -screen 0 1280x1024x24 -nolisten tcp &
\ No newline at end of file
+XVFB=/usr/bin/Xvfb
+XVFBARGS="$DISPLAY -ac -screen 0 1280x1024x24 +extension RANDR"
+PIDFILE=/var/xvfb_${DISPLAY:1}.pid
+case "$1" in
+  start)
+    echo -n "Starting virtual X frame buffer: Xvfb"
+    /sbin/start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS
+    echo "."
+    ;;
+  stop)
+    echo -n "Stopping virtual X frame buffer: Xvfb"
+    /sbin/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