Skip to content

Instantly share code, notes, and snippets.

@thermistor
Forked from trodrigues/kill_test_servers.sh
Created November 6, 2012 17:59
Show Gist options
  • Save thermistor/4026389 to your computer and use it in GitHub Desktop.
Save thermistor/4026389 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