mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-12-05 05:18:12 +08:00
取消添加脚本文件权限
This commit is contained in:
parent
1f0151abd2
commit
8e6a4362a8
@ -6,7 +6,6 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.system.SystemUtil;
|
||||
import io.jpom.model.BaseModel;
|
||||
import io.jpom.system.AgentConfigBean;
|
||||
import io.jpom.util.CommandUtil;
|
||||
@ -66,7 +65,7 @@ public class ScriptModel extends BaseModel {
|
||||
return FileUtil.file(path, getId(), "script." + CommandUtil.SUFFIX);
|
||||
}
|
||||
|
||||
public File getLogFile(boolean get) {
|
||||
public File logFile() {
|
||||
if (StrUtil.isEmpty(getId())) {
|
||||
throw new IllegalArgumentException("id 为空");
|
||||
}
|
||||
@ -84,10 +83,10 @@ public class ScriptModel extends BaseModel {
|
||||
public void saveFile() {
|
||||
File file = getFile(true);
|
||||
FileUtil.writeString(getContext(), file, CharsetUtil.CHARSET_UTF_8);
|
||||
// 添加权限
|
||||
if (SystemUtil.getOsInfo().isLinux()) {
|
||||
CommandUtil.execCommand("chmod 755 " + FileUtil.getAbsolutePath(file));
|
||||
}
|
||||
// // 添加权限
|
||||
// if (SystemUtil.getOsInfo().isLinux()) {
|
||||
// CommandUtil.execCommand("chmod 755 " + FileUtil.getAbsolutePath(file));
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -8,11 +8,13 @@ import cn.hutool.core.io.LineHandler;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.system.SystemUtil;
|
||||
import cn.jiangzeyin.common.DefaultSystemLog;
|
||||
import cn.jiangzeyin.common.JsonMessage;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.jpom.JpomApplication;
|
||||
import io.jpom.model.data.ScriptModel;
|
||||
import io.jpom.util.CommandUtil;
|
||||
import io.jpom.util.SocketSessionUtil;
|
||||
|
||||
import javax.websocket.Session;
|
||||
@ -38,13 +40,16 @@ public class ScriptProcessBuilder implements Runnable {
|
||||
private InputStream errorInputStream;
|
||||
|
||||
private ScriptProcessBuilder(ScriptModel scriptModel, String args) {
|
||||
this.logFile = scriptModel.getLogFile(true);
|
||||
this.logFile = scriptModel.logFile();
|
||||
this.scriptFile = scriptModel.getFile(true);
|
||||
//
|
||||
String script = FileUtil.getAbsolutePath(scriptFile);
|
||||
processBuilder = new ProcessBuilder();
|
||||
List<String> command = StrUtil.splitTrim(args, StrUtil.SPACE);
|
||||
command.add(0, script);
|
||||
if (SystemUtil.getOsInfo().isLinux()) {
|
||||
command.add(0, CommandUtil.SUFFIX);
|
||||
}
|
||||
DefaultSystemLog.LOG().info(CollUtil.join(command, StrUtil.SPACE));
|
||||
processBuilder.command(command);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user