@wu529778790/open-im 1.2.3-beta.0 → 1.2.3-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/cli.js +21 -0
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/cli.js
CHANGED
|
@@ -153,6 +153,25 @@ async function cmdStop() {
|
|
|
153
153
|
}
|
|
154
154
|
console.log(`open-im 已停止 (pid=${pid})`);
|
|
155
155
|
}
|
|
156
|
+
async function cmdRestart() {
|
|
157
|
+
const pid = getPid();
|
|
158
|
+
const wasRunning = pid && isRunning(pid);
|
|
159
|
+
if (wasRunning) {
|
|
160
|
+
console.log(`正在停止 open-im (pid=${pid})...`);
|
|
161
|
+
await cmdStop();
|
|
162
|
+
// 等待进程完全停止
|
|
163
|
+
for (let i = 0; i < 30; i++) {
|
|
164
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
165
|
+
if (!pid || !isRunning(pid))
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
console.log("open-im 未在后台运行");
|
|
171
|
+
}
|
|
172
|
+
console.log("正在启动 open-im...");
|
|
173
|
+
await cmdStart();
|
|
174
|
+
}
|
|
156
175
|
async function cmdInit() {
|
|
157
176
|
console.log("\n━━━ open-im 配置向导 ━━━\n");
|
|
158
177
|
const saved = await runInteractiveSetup();
|
|
@@ -174,6 +193,7 @@ function showHelp(exitCode = 0) {
|
|
|
174
193
|
命令:
|
|
175
194
|
start 后台运行服务
|
|
176
195
|
stop 停止后台服务
|
|
196
|
+
restart 重启服务
|
|
177
197
|
init 配置向导(首次或追加配置,会覆盖已有 config.json)
|
|
178
198
|
dev 前台运行(调试模式),Ctrl+C 停止
|
|
179
199
|
|
|
@@ -189,6 +209,7 @@ const cmd = process.argv[2];
|
|
|
189
209
|
const commands = {
|
|
190
210
|
start: cmdStart,
|
|
191
211
|
stop: cmdStop,
|
|
212
|
+
restart: cmdRestart,
|
|
192
213
|
init: cmdInit,
|
|
193
214
|
dev: main,
|
|
194
215
|
};
|