Setup Selenium Hub as a Service in Ubuntu 14.04

Setup Selenium Hub as a Service in Ubuntu 14.04:

If you have moved to Ubuntu 16.04, kindly refer to this link. 
Setting up selenium hub as a service saves you from the tedious task of running long commands to start and restart the selenium server several times during your development. Also, this ensures that you grid is always up and running and you don't have to bring it back up every time your machine\automation server gets rebooted.
  • Run the below command to create selenium server config file. Enter your password if asked. 
sudo nano /etc/init/selenium.conf
  • Paste the below content in this config file. 
description     "run Selenium Server as hub"

    start on runlevel [2345]
      stop on runlevel [!2345]

      respawn

      exec java -jar /opt/softwares/selenium-server.jar -role hub -port 4444


      • Press Ctrl+X followed by Y and Enter to confirm saving the changes to the file
      • Now create a symbolic link of this config file at destination /etc/init.d/selenium by running the command
      sudo ln -s /etc/init/selenium.conf /etc/init.d/selenium
      • Run the below command to start the selenium hub service.
      sudo service selenium start


      Tips:
      • Every time you want to restart the grid you can just run sudo service selenium restart
      • You can also configure any additional parameters you might have along with you java -jar /opt/softwares/selenium-server.jar -role hub -port 4444 command during creation of selenium.conf file.

      Comments

      Popular posts from this blog

      Get rid of "Timed out receiving message from renderer"

      Selenium Grid using Zalenium

      Selenium - How to initialize Chrome and Firefox WebDriver