Skip to content

Instantly share code, notes, and snippets.

@cjohansen
Created May 10, 2012 19:45
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cjohansen/2655403 to your computer and use it in GitHub Desktop.
Save cjohansen/2655403 to your computer and use it in GitHub Desktop.
Run the Buster.JS server with a Phantom.JS client
#!/bin/bash
# Based on work by Tiago Rodrigues
# Here: http://trodrigues.net/presentations/buster-ci/#/24
# And here: https://gist.github.com/2630210
# Usage:
# env BUSTER_HOME=/where/you/installed/buster ./buster-server.sh start|stop
function buster_server_pid(){
echo `ps aux|grep buster-server|grep node|awk '{ print $2 }'`
}
function phantom_server_pid(){
echo `ps aux|grep phantomjs|grep buster|awk '{ print $2 }'`
}
case "$1" in
"start")
$BUSTER_HOME/bin/buster-server & # fork to a subshell
sleep 4 # takes a while for buster server to start
phantomjs $BUSTER_HOME/script/phantom.js &
echo "Started Buster.JS server with Phantom.JS client"
;;
"stop")
kill `buster_server_pid`
kill `phantom_server_pid`
echo "Killed Buster.JS server and Phantom.JS client"
;;
*)
echo "Usage:
$0 start|stop"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment