Skip to content

Commit

Permalink
[Improvement][worker]优化源文件不存在,则软链接创建失败 (#599)
Browse files Browse the repository at this point in the history
* [Improvement][service] Remove fixed component versions

* [Improvement][api]优化ALERTMANAGER安装

* [Bug][service] HADOOP_HOME变量失效

* Revert "[Improvement][api]优化ALERTMANAGER安装"

This reverts commit 3e9a13e.

* 恢复代码

* [Improvement][api]优化alertmanager安装过程

* [Improvement][worker]Fix-源文件不存在,则软链接创建失败

* no message
  • Loading branch information
blackflash997997 authored Aug 15, 2024
1 parent 27d40c3 commit c2ce16f
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ public void exec() {
String realTarget = basePath + Constants.SLASH + target;
File sourceFile = new File(source);
File targetFile = new File(realTarget);
if (!targetFile.exists() && sourceFile.exists()) {
// 先创建文件夹
FileUtil.mkdir(targetFile.getParent());
ShellUtils.exceShell("ln -s " + source + " " + realTarget);
log.info("Create symbolic dir: {} to {}", source, realTarget);
FileUtil.mkdir(targetFile.getParent());
ShellUtils.exceShell("ln -s " + source + " " + realTarget);

if (!targetFile.exists()) {
if (sourceFile.exists()) {
log.info("Create existing symbolic dir: {} to {}", source, realTarget);
} else {
log.warn("Create non-existent symbolic dir: {} to {}", source, realTarget);
}
}
}
}
}

0 comments on commit c2ce16f

Please sign in to comment.