You are here

selenium.sh in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.5

#!/bin/bash

case "${1:-''}" in
    'start')
        if test -f /tmp/selenium.pid
        then
            echo "Selenium is already running."
        else
            java -jar /usr/lib/selenium/selenium-server-standalone.jar -port 4445 > /var/log/selenium/output.log 2> /var/log/selenium/error.log & echo $! > /tmp/selenium.pid
            echo "[  OK  ] Starting Selenium on the 4445 port ..."

            error=$?
            if test $error -gt 0
            then
                echo "[ Error ] ${bon}Error $error! Could not start Selenium!${boff}"
            fi
        fi
    ;;
    'stop')
        if test -f /tmp/selenium.pid
        then
            echo "Stopping Selenium..."
            PID=`cat /tmp/selenium.pid`
            kill -3 $PID
            if kill -9 $PID ;
                then
                    sleep 2
                    test -f /tmp/selenium.pid && rm -f /tmp/selenium.pid
                else
                    echo "[ Error ] Selenium could not be stopped ..."
                fi
        else
            echo "[ Error ] Selenium is not running."
        fi
        ;;
    'restart')
        if test -f /tmp/selenium.pid
        then
            kill -HUP `cat /tmp/selenium.pid`
            test -f /tmp/selenium.pid && rm -f /tmp/selenium.pid
            sleep 1
            java -jar /usr/lib/selenium/selenium-server-standalone.jar -port 4445 > /var/log/selenium/output.log 2> /var/log/selenium/error.log & echo $! > /tmp/selenium.pid
            echo "[  OK  ] Reload Selenium on the 4445 port ..."
        else
            echo "[ Error ] Selenium isn't running..."
        fi
        ;;
    *)      # no parameter specified
        echo "Usage: $SELF start|stop|restart"
        exit 1
    ;;
esac

File

tests/tools/install-selenium-server/selenium.sh
View source
  1. #!/bin/bash
  2. case "${1:-''}" in
  3. 'start')
  4. if test -f /tmp/selenium.pid
  5. then
  6. echo "Selenium is already running."
  7. else
  8. java -jar /usr/lib/selenium/selenium-server-standalone.jar -port 4445 > /var/log/selenium/output.log 2> /var/log/selenium/error.log & echo $! > /tmp/selenium.pid
  9. echo "[ OK ] Starting Selenium on the 4445 port ..."
  10. error=$?
  11. if test $error -gt 0
  12. then
  13. echo "[ Error ] ${bon}Error $error! Could not start Selenium!${boff}"
  14. fi
  15. fi
  16. ;;
  17. 'stop')
  18. if test -f /tmp/selenium.pid
  19. then
  20. echo "Stopping Selenium..."
  21. PID=`cat /tmp/selenium.pid`
  22. kill -3 $PID
  23. if kill -9 $PID ;
  24. then
  25. sleep 2
  26. test -f /tmp/selenium.pid && rm -f /tmp/selenium.pid
  27. else
  28. echo "[ Error ] Selenium could not be stopped ..."
  29. fi
  30. else
  31. echo "[ Error ] Selenium is not running."
  32. fi
  33. ;;
  34. 'restart')
  35. if test -f /tmp/selenium.pid
  36. then
  37. kill -HUP `cat /tmp/selenium.pid`
  38. test -f /tmp/selenium.pid && rm -f /tmp/selenium.pid
  39. sleep 1
  40. java -jar /usr/lib/selenium/selenium-server-standalone.jar -port 4445 > /var/log/selenium/output.log 2> /var/log/selenium/error.log & echo $! > /tmp/selenium.pid
  41. echo "[ OK ] Reload Selenium on the 4445 port ..."
  42. else
  43. echo "[ Error ] Selenium isn't running..."
  44. fi
  45. ;;
  46. *) # no parameter specified
  47. echo "Usage: $SELF start|stop|restart"
  48. exit 1
  49. ;;
  50. esac