Many a times we would want to write up a script to start the selenium server using a shell script…
So here is the script
#!/bin/sh
#
# @Author – Sirisha
# @Date - May 29 2012
# Script to start the Selenium Server on a given host
#
# Defined the hostname
hostname=somehostname
# Defined the path to the selenium server
serverPath=~/seleniumServer/
# Define the Selenium Server version jar
server=selenium-server-standalone-2.12.0.jar
# Define the Search String for the server
SERVICE_STRING="'java -jar $server'"
# Clear the terminal
clear
echo "service string is: $SERVICE_STRING"
echo "Starting Selenium Server on $hostname"
# Run the command to get the process list
ps -ef | grep -v grep | grep selenium
# Check if the Selenium Server is already running
if [ $? -eq 0 ]
then
echo "$server is running, everything is fine"
else
echo "$server is not running"
# Go to the selenium server path
cd $serverPath
# Start the server
java -jar $server
fi
# Exit with a proper status
exit 0
Comments