Friday, November 2, 2012

SSH - Read from Unix



import lrapi.lr;

import java.io.IOException;
import org.twdata.enchanter.SSH;
import org.twdata.enchanter.impl.DefaultSSH;

public class Actions
{

public int init() throws Throwable {
return 0;
}//end of init


public int action() throws Throwable {

       
SSH ssh = new DefaultSSH();
ssh.connect("asde12nus135pf", 22, "asdd254515", "akhfdasd");
String readline = null;
readline = ssh.getLine();
System.out.println("readline"+readline);
while (! readline.equals("au10qap3f0tels2 $")) {
   readline = ssh.getLine();
   System.out.println("readline"+readline);

   readline = ssh.getLine();
   System.out.println("readline"+readline);

 
}
System.out.println("Out of loop - While");
System.out.println("15:"+ssh.lastLine());
System.out.println("3"+ssh.lastLine());
System.out.println("4"+ssh.getLine());
System.out.println("date "+ssh.getLine());
System.out.println("ls "+ssh.getLine());
System.out.println("ls "+ssh.lastLine());

return 0;
}//end of action


public int end() throws Throwable {
return 0;
}//end of end
}

No comments:

Post a Comment