| | |
| | | String path;
|
| | | @Value("${minio.enabled}")
|
| | | Boolean minioEnabled;
|
| | |
|
| | | //mediamtx
|
| | | String mediamtxName = "mediamtx.exe";
|
| | | @Value("${mediamtx.enabled}")
|
| | |
| | | @Override
|
| | | public void initialize(ConfigurableApplicationContext applicationContext) {
|
| | | if (Platform.isWindows()) {
|
| | | String exePath = System.getProperty("user.dir") + File.separator + "server" + File.separator + "redis" + File.separator + redisName;
|
| | | String workingDir = System.getProperty("user.dir") + File.separator + "server" + File.separator + "redis";
|
| | | String exePath = workingDir +File.separator+ redisName;
|
| | | List<String> cmd = new ArrayList<>();
|
| | | cmd.add(exePath);
|
| | | if (CmdUtils.isProcessRunning(redisName)) {
|
| | |
| | | CmdUtils.stopProcess(redisName);
|
| | | }
|
| | | // 启动后台进程
|
| | | CmdUtils.commandStart(redisName, cmd, null);
|
| | | CmdUtils.commandStart(workingDir, redisName, cmd, null);
|
| | | // 启动cmd窗口
|
| | | //String[] command = {"cmd", "/c", "start", exePath, "-H127.0.0.1:8000", "-o"};
|
| | | //CmdUtils.commandStart(command);
|
| | |
| | | if (minioEnabled) {
|
| | | log.info("初始化启动minio");
|
| | | if (Platform.isWindows()) {
|
| | | String exePath = System.getProperty("user.dir") + File.separator + "server" + File.separator + "minio" + File.separator + minioName;
|
| | | String workingDir = System.getProperty("user.dir") + File.separator + "server" + File.separator + "minio";
|
| | | String exePath = workingDir + File.separator + minioName;
|
| | | Map<String, String> env = new HashMap<>();
|
| | | env.put("MINIO_ROOT_USER", accessKey);
|
| | | env.put("MINIO_ROOT_PASSWORD", secretKey);
|
| | |
| | | CmdUtils.stopProcess(minioName);
|
| | | }
|
| | | // 启动后台进程
|
| | | CmdUtils.commandStart(minioName, cmd, env);
|
| | | CmdUtils.commandStart(workingDir, minioName, cmd, env);
|
| | | // 启动cmd窗口
|
| | | //String[] command = {"cmd", "/c", "start", exePath};
|
| | | //CmdUtils.commandStart(command);
|
| | |
| | | if (mediamtxEnabled) {
|
| | | log.info("初始化启动mediaMTX");
|
| | | if (Platform.isWindows()) {
|
| | | String exePath = System.getProperty("user.dir") + File.separator + "server" + File.separator + "mediamtx" + File.separator + mediamtxName;
|
| | | String ymlPath = System.getProperty("user.dir") + File.separator + "server" + File.separator + "mediamtx" + File.separator + "mediamtx.yml";
|
| | |
|
| | | String workingDir = System.getProperty("user.dir") + File.separator + "server" + File.separator + "mediamtx";
|
| | | String exePath = workingDir + File.separator + mediamtxName;
|
| | | String ymlPath = workingDir + File.separator + "mediamtx.yml";
|
| | | List<String> cmd = new ArrayList<>();
|
| | | cmd.add(exePath);
|
| | | cmd.add(ymlPath);
|
| | | // cmd.add(ymlPath);
|
| | | if (CmdUtils.isProcessRunning(mediamtxName)) {
|
| | | // 进程已经在运行,结束该进程
|
| | | CmdUtils.stopProcess(mediamtxName);
|
| | | }
|
| | | // 启动后台进程
|
| | | CmdUtils.commandStart(mediamtxName, cmd, null);
|
| | | CmdUtils.commandStart(workingDir, mediamtxName, cmd, null);
|
| | | // 启动cmd窗口
|
| | | // String[] command = {"cmd","/c","start",exePath,ymlPath};
|
| | | // CmdUtils.commandStart(command);
|