-
-
Save krishtoautomate/29646881344f5c211dac93318ddc7c56 to your computer and use it in GitHub Desktop.
Selenium Grid service script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
case "${1:-''}" in | |
'start') | |
if test -f /tmp/selenium-grid.pid | |
then | |
echo "Selenium Grid is already running." | |
else | |
java -jar /home/bkr/selenium/selenium-server-standalone-2.9.0.jar -port 5555 -role hub > /var/log/selenium/selenium-grid.log 2> /var/log/selenium/selenium-grid-error.log & echo $! > /tmp/selenium-grid.pid | |
echo "Starting Selenium Grid..." | |
error=$? | |
if test $error -gt 0 | |
then | |
echo "${bon}Error $error! Couldn't start Selenium Grid!${boff}" | |
fi | |
fi | |
;; | |
'stop') | |
if test -f /tmp/selenium-grid.pid | |
then | |
echo "Stopping Selenium Grid..." | |
PID=`cat /tmp/selenium-grid.pid` | |
kill -3 $PID | |
if kill -9 $PID ; | |
then | |
sleep 2 | |
test -f /tmp/selenium-grid.pid && rm -f /tmp/selenium-grid.pid | |
else | |
echo "Selenium Grid could not be stopped..." | |
fi | |
else | |
echo "Selenium Grid is not running." | |
fi | |
;; | |
'restart') | |
if test -f /tmp/selenium-grid.pid | |
then | |
kill -HUP `cat /tmp/selenium-grid.pid` | |
test -f /tmp/selenium-grid.pid && rm -f /tmp/selenium-grid.pid | |
sleep 1 | |
java -jar /home/bkr/selenium/selenium-server-standalone-2.9.0.jar -port 5555 -role hub > /var/log/selenium/selenium-grid.log 2> /var/log/selenium/selenium-grid-error.log & echo $! > /tmp/selenium-grid.pid | |
echo "Reload Selenium Grid..." | |
else | |
echo "Selenium Grid isn't running..." | |
fi | |
;; | |
*) # no parameter specified | |
echo "Usage: $SELF start|stop|restart|reload|force-reload|status" | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment