title: Execute Selenium at the startup
body: <p>I'm using Selenium to automate a browser in a Server from a client, but I want that the server execute selenium automatically at the startup.</p>
  
  <p>I have 3 files in /etc/init:</p>
  
  <p><strong>proxyserver.conf:</strong></p>
  
  <pre><code>respawn 
  start on runlevel [23]
  script
      exec java -jar selenium-server-standalone-2.20.0.jar -role hub -port 1111
  end script
  </code></pre>
  
  <p><strong>proxyserver2.conf</strong> and <strong>proxyserver3.conf</strong> that are the same thing and change only the content of "script":</p>
  
  <pre><code>exec java -Dwebdriver.chrome.driver=/home/marco/selenium-client/chromedriver -jar selenium-server-standalone-2.20.0.jar -role node -port 2222 -hub http://192.168.1.12:1111 -browserName=chrome,maxInstances=5
  </code></pre>
  
  <p>If I execute this commands at the startup with this method, when I execute Selenium on the Client, it give me this error:</p>
  
  <pre><code>Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
  </code></pre>
  
  <p>But if I execute in the terminal the same commands that I use in /etc/init, all works perfectly... why?!</p>
  
  <p>One last thing, if I execute:</p>
  
  <pre><code>ps aux | grep selenium
  </code></pre>
  
  <p>when the server the scripts at the startup it gives me:</p>
  
  <pre><code>root 746 0.0 12.1 677080 124468 ? Ssl Apr23 8:10 java -Dwebdriver...
  root 749 0.0 12.7 685552 130280 ? Ssl Apr23 8.09 java -Dwebdriver...
  root 755 0.0 1.9  680168 20240  ? Ssl Apr23 8.08 java -jar selenium...
  </code></pre>
  
  <p>when I execute in the terminal it gives me:</p>
  
  <pre><code>1000 9764 6.6  3.0 679236 30992 pts/0 Sl+ 10.33 0:01 java -jar...
  1000 9783 14.0 3.0 677112 31752 pts/1 Sl+ 10.33 0:01 java -Dwebdriver...
  1000 9792 12.6 3.0 675472 30944 pts/2 Sl+ 10.34 0:01 java -Dwebdriver...
  </code></pre>
  
  <p>Why it can't works?</p>
  
  <p>thanks!!</p>