Skip to content

Instantly share code, notes, and snippets.

@alexnederlof
Created November 20, 2012 19:49

Revisions

  1. alexnederlof revised this gist Nov 20, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion selenium-start-stop.sh
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,9 @@
    # Note that this script requires you to have
    # an X window running on Display :90
    # This can be done by running: /usr/bin/Xvfb :90 -ac -screen 0 1024x768x8 &
    #
    # You can save this script as /etc/init.d/selenium to start and stop selenium


    PORT=4443

    DESC="Selenium server"
  2. alexnederlof revised this gist Nov 20, 2012. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions selenium-start-stop.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,9 @@
    #!/bin/bash
    # Note that this script required you to have
    # You can save this script as /etc/init.d/selenium to start and stop selenium
    # Note that this script requires you to have
    # an X window running on Display :90
    # This can be done by running: /usr/bin/Xvfb :90 -ac -screen 0 1024x768x8 &
    # You can save this script as /etc/init.d/selenium to start and stop selenium


    PORT=4443

  3. alexnederlof revised this gist Nov 20, 2012. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions selenium-start-stop.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    #!/bin/bash
    # Note that this script required you to have
    # You can save this script as /etc/init.d/selenium to start and stop selenium
    # an X window running on Display :90

    PORT=4443
  4. alexnederlof renamed this gist Nov 20, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. alexnederlof created this gist Nov 20, 2012.
    49 changes: 49 additions & 0 deletions selenium-start-stop
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    #!/bin/bash
    # Note that this script required you to have
    # an X window running on Display :90

    PORT=4443

    DESC="Selenium server"
    RUN_AS=selenium
    JAVA_BIN=/usr/bin/java

    SELENIUM_DIR=/etc/selenium
    PID_FILE="/var/run/selenium.pid"
    JAR_FILE="/var/lib/selenium/selenium-server.jar"
    LOG_FILE="/var/log/selenium/selenium.log"
    CHROME_DRIVER="/var/lib/chrome-driver/chromedriver"

    DAEMON_OPTS=" -jar $JAR_FILE -Dwebdriver.chrome.driver=$CHROME_DRIVER -log $LOG_FILE -port $PORT"

    NAME=selenium

    export DISPLAY=:90

    case "$1" in
    start)
    echo -n "Starting $DESC: "
    start-stop-daemon -c $RUN_AS --start --background --pidfile $PID_FILE --make-pidfile --exec $JAVA_BIN -- $DAEMON_OPTS
    echo "$NAME."
    ;;

    stop)
    echo -n "Stopping $DESC: "
    start-stop-daemon --stop --pidfile $PID_FILE
    echo "$NAME."
    ;;

    restart|force-reload)
    echo -n "Restarting $DESC: "
    start-stop-daemon --stop --pidfile $PID_FILE
    sleep 1
    start-stop-daemon -c $RUN_AS --start --background --pidfile $PID_FILE --make-pidfile --exec $JAVA_BIN -- $DAEMON_OPTS
    echo "$NAME."
    ;;

    *)
    N=/etc/init.d/$NAME
    echo "Usage: $N {start|stop|restart|force-reload}" >&2
    exit 1
    ;;
    esac