If a process is started through java runtime.exec (via ssh) how do you get back to this process to kill it (via ssh)? Is there a way to obtain the PID of the invoked process once started? Is sending "kill" via ssh the only way if a PID is obtainable?
Process p;
public void startSomething()
{
String[] cmd = {"/usr/bin/ssh", "remoteIPAdd", "./prog"};
try
{
p = Runtime.getRuntime().exec(cmd);
}
catch(IOException e)
{
System.out.print("Epic Fail");
}
}
public void stopSomething()
{
//p.destroy if local would work but not remotely
//How do I stop the remote process then?
}