Skip to content

Instantly share code, notes, and snippets.

@trodrigues
Created May 7, 2012 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save trodrigues/2630210 to your computer and use it in GitHub Desktop.
Save trodrigues/2630210 to your computer and use it in GitHub Desktop.
kill script for phantom, buster, selenium
#!/bin/bash
# just call with ./kill_test_servers.sh buster-server|selenium|phantom
function get_buster_server_pid(){
echo `ps aux|grep buster-server|grep node|awk '{ print $2 }'`
}
function get_selenium_server_pid(){
echo `ps aux|grep selenium|grep java|awk '{ print $2 }'`
}
function get_phantom_server_pid(){
echo `ps aux|grep phantomjs|grep buster|awk '{ print $2 }'`
}
case "$1" in
"buster-server") server_pid=`get_buster_server_pid` ;;
"selenium") server_pid=`get_selenium_server_pid` ;;
"phantom") server_pid=`get_phantom_server_pid` ;;
esac
if [ "$server_pid" != "" ] ; then
kill $server_pid
echo "killed"
else
echo "not killed"
echo $server_pid
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment