-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (23 loc) · 785 Bytes
/
index.js
File metadata and controls
26 lines (23 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const fs = require("fs");
const runCmd = require("./server/utils/runCmd");
const logger = require("./server/utils/logger");
class ZuoDeploy {
constructor() {}
async start(args) {
// 存储参数,用于多文件传参
fs.writeFileSync("args.json", JSON.stringify(args));
// 删除原先的服务
runCmd("pm2", ["delete", "zuodeploy"], () => {});
// // 防止异步并行,sleep 1s
await new Promise((resolve) => setTimeout(resolve, 1000));
// 开启 pm2 服务
const argv = ["start", __dirname + "/server/index.js", "-n", "zuodeploy"];
runCmd("pm2", argv, (text) => {
logger.log(text);
});
// runCmd("node", [__dirname + "/server/index.js"], (text) => {
// logger.log(text);
// });
}
}
module.exports = ZuoDeploy;