use of com.hazelcast.simulator.utils.BashCommand in project hazelcast-simulator by hazelcast.
the class AgentUtils method stopAgents.
public static void stopAgents(SimulatorProperties properties, Registry registry) {
String shutdownScript = getConfigurationFile("agent_shutdown.sh").getAbsolutePath();
new BashCommand(shutdownScript).addParams(publicAddressesString(registry)).addEnvironment(properties.asMap()).execute();
}
use of com.hazelcast.simulator.utils.BashCommand in project hazelcast-simulator by hazelcast.
the class ProcessSuicideThread method run.
@Override
public void run() {
if (parentPid == null || intervalSeconds == 0) {
return;
}
try {
for (; ; ) {
SECONDS.sleep(intervalSeconds);
BashCommand bashCommand = new BashCommand("ps -p " + parentPid);
bashCommand.setThrowsException(true);
try {
bashCommand.execute();
} catch (Exception e) {
String msg = "Process terminating; parent process with pid [" + parentPid + "] is not alive";
LOGGER.error(msg);
System.err.println(msg);
System.exit(1);
}
}
} catch (InterruptedException e) {
ignore(e);
}
}
use of com.hazelcast.simulator.utils.BashCommand in project hazelcast-simulator by hazelcast.
the class AgentsSshCli method executeCommand.
private void executeCommand() {
List commands = options.nonOptionArguments();
if (commands.size() != 1) {
throw new CommandLineExitException("1 argument expected");
}
String command = (String) commands.get(0);
String sshOptions = properties.get("SSH_OPTIONS");
String simulatorUser = properties.get("SIMULATOR_USER");
for (AgentData agent : findAgents()) {
System.out.println("[" + agent.getPublicAddress() + "]");
new BashCommand("ssh -n -o LogLevel=quiet " + sshOptions + " " + simulatorUser + "@" + agent.getPublicAddress() + " '" + command + "'").setSystemOut(true).addEnvironment(properties.asMap()).execute();
}
}
use of com.hazelcast.simulator.utils.BashCommand in project hazelcast-simulator by hazelcast.
the class JetDriver method install.
@Override
public void install() {
String cloud = get("CLOUD_PROVIDER");
if ("embedded".equals(cloud)) {
return;
}
String versionSpec = get("VERSION_SPEC");
LOGGER.info("Installing versionSpec [" + versionSpec + "] on " + agents.size() + " agents...");
String publicIps = "";
if (!"local".equals(cloud)) {
publicIps = AgentData.publicAddressesString(agents);
}
String vendor = get("VENDOR");
String installFile = getConfigurationFile("install-" + vendor + ".sh").getPath();
LOGGER.info("Installing '" + vendor + "' version '" + versionSpec + "' on Agents using " + installFile);
new BashCommand(installFile).addParams(get("SESSION_ID"), versionSpec, publicIps).addEnvironment(properties).execute();
LOGGER.info("Successfully installed '" + vendor + "'");
LOGGER.info("Install successful!");
}
use of com.hazelcast.simulator.utils.BashCommand in project hazelcast-simulator by hazelcast.
the class TestCaseRunner method recordTimestamp.
private void recordTimestamp(String label) {
String startScript = getConfigurationFile("record_timestamp.sh").getAbsolutePath();
new BashCommand(startScript).addParams(publicAddressesString(registry), coordinatorParameters.getSessionId(), testCase.getId(), label).addEnvironment(coordinatorParameters.getSimulatorProperties().asMap()).execute();
}
Aggregations