Created
August 11, 2014 11:17
-
-
Save bkon/ae7783424fe35804331c to your computer and use it in GitHub Desktop.
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
BASH=/bin/bash | |
CHROME_HOME=/var/lib/chrome | |
JAVA=/usr/bin/java | |
JAVA_ARGS="-jar /usr/local/bin/<%= node['selenium']['jar'] %> -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -Dwebdriver.chrome.logfile=/var/log/selenium/chromedriver.log -browser browserName=chrome,binary=/usr/bin/chromium-browser" | |
PIDFILE=/var/run/selenium.pid | |
case "$1" in | |
start) | |
echo -n "Starting selenium service" | |
HOME=$CHROME_HOME DISPLAY=:99 /sbin/start-stop-daemon \ | |
--start \ | |
--verbose \ | |
--chuid selenium \ | |
--pidfile $PIDFILE \ | |
--make-pidfile \ | |
--background \ | |
--startas $BASH -- -c "exec $JAVA $JAVA_ARGS >>/var/log/selenium/selenium.log 2>&1" | |
echo "." | |
;; | |
stop) | |
echo -n3 "Stopping selenium service" | |
/sbin/start-stop-daemon --stop --quiet --pidfile $PIDFILE | |
rm -f $PIDFILE | |
echo "." | |
;; | |
restart) | |
$0 stop | |
$0 start | |
;; | |
*) | |
echo "Usage: /etc/init.d/selenium {start|stop|restart}" | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment