I'm automating a test scenario which validates back end logs in remote server using JAVA & selenium. I need to implement a method which will used to connect to the remote server using the pem file and tail the logs . Then I'm using Stringbuffer to read that logs one by one and validate with expected output.
I have tried the Process API in java to execute the shell command to connect to the remote server. But it's not working .please help me with this. are there any other options to do this?
commands[0]= "ssh /path_to_pem_file.pem username@server_ip";
commands[1]="tail -f /carbon.log";
Process p = Runtime.getRuntime().exec(commands);