refactor(cli): 优化脚本

This commit is contained in:
2024-02-26 19:04:37 +08:00
parent 9e6e8fbc61
commit 5ecc3daac0
2 changed files with 17 additions and 10 deletions

View File

@@ -1,9 +1,9 @@
#!/bin/bash
root_path=/apps/zone_scfp/hudi/cloud
jars_path=/data/datalake/jars
jdk_path=/opt/jdk8u252-b09/bin/java
arguments=$@
curl ftp://yyy:QeY\!68\)4nH1@132.121.122.15:2222/service-cli-runner-1.0.0-SNAPSHOT.jar -o ${root_path}/service-cli-runner.jar
${jdk_path} -jar ${root_path}/service-cli-runner.jar --spring.profiles.active=b9 $arguments
chmod +x *.sh
curl ftp://yyy:QeY\!68\)4nH1@132.121.122.15:2222/service-cli-runner-1.0.0-SNAPSHOT.jar -o ${jars_path}/service-cli-runner.jar
${jdk_path} -jar ${jars_path}/service-cli-runner.jar --spring.profiles.active=b12 $arguments
chmod +x cloud/*.sh

View File

@@ -82,18 +82,22 @@ public class RunnerApplication implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) throws IOException {
logger.info("Loading runtime info: {}", mapper.writeValueAsString(runtimeInfo));
generateCloud(Paths.get("cloud"));
generateCloud(Paths.get("command"));
}
private void generateCloud(Path root) throws IOException {
Files.createDirectories(root);
String absolutRootPath = root.toAbsolutePath().toString();
logger.info("Current path: {}", absolutRootPath);
Path planPath = Paths.get("deploy.plan");
Map<String, List<String>> deployPlans = new HashMap<>();
if (Files.exists(planPath) && !deployInformationProperties.getShuffler()) {
deployPlans = mapper.readValue(new String(Files.readAllBytes(planPath)), new TypeReference<Map<String, List<String>>>() {});
}
Path root = Paths.get("");
Files.createDirectories(root);
String absolutRootPath = root.toAbsolutePath().toString();
logger.info("Current path: {}", absolutRootPath);
TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH));
Template deployTemplate = engine.getTemplate("deploy.ftl");
for (ServiceInfoWrapper serviceInfo : serviceInfoList) {
@@ -256,4 +260,7 @@ public class RunnerApplication implements ApplicationRunner {
Files.deleteIfExists(planPath);
Files.write(planPath, mapper.writeValueAsString(deployPlans).getBytes());
}
private void generateCommand(Path root) throws IOException {
}
}