If you want to check whether selenium server is running or not, hit the url "http://host:port/selenium-server/driver/?cmd=testComplete", If response is returned that means, server is running on the given host:port.
Here is the Java code for this:
import java.net.HttpURLConnection;
import java.net.URL;
public static boolean isSeleniumServerRunning(String host, int port)
{
try {
String baseUrl = "http://" + host + ":" + port;
System.out.println("Checking selenium server status [" + baseUrl + "]");
URL url = new URL(baseUrl + "/selenium-server/driver/?cmd=testComplete");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
if(connection.getResponseCode() == HttpURLConnection.HTTP_OK)
return true;
} catch (Exception e) {
System.err.println("Could not check selenium server status: " + e.getMessage());
e.printStackTrace();
}
return false;
}
Here are the useful trick for GNU screen: 1. Give access to other users on the screen:
- Let say screen "test" is running on host 15.25.125.148 with user "xyz"
- run command "Ctrl a :"
- type "multiuser on" to enable multiuser mode
- type "acladd <unix username>" (to whom you want to give access)
- type "aclchg <args>" to change permissions on the screen for that user
- Now the user will login on that host via command "ssh user@15.25.125.148"
- attach to screen with command "screen -x xyz/test"
2. Changing session name of the running screen
The default session name created by the screen command is constructed from the tty and host names, which isn't very intuitive. To change this session name, run this command on your screen session
Ctrl a :sessionname newSessionName
3. Send a command to a window in a running screen session from the commandline
screen -x <screen session name> -p <window number or name> -X stuff '<command>\012'
4. Create screen session with commands running
- First, create .screenrc_test with following contents where you specify your tabbed sessions and commands
startup_message off
vbell off
caption always "%{= bb}%{+b w}%n %h %=%t %c"
hardstatus alwayslastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"
activity "Activity in %t(%n)"
deflogin on
shell -/bin/bash
screen -t TAB1
stuff "cd $HOME && ls -1rt | tail -1 | xargs tail -f \012"
screen -t TAB2
stuff "cd $HOME && top \012"