bm2 1.0.21 → 1.0.22
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/package.json +1 -1
- package/src/startup-manager.ts +37 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bm2",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22",
|
|
4
4
|
"description": "A blazing-fast, full-featured process manager built entirely on Bun native APIs. The modern PM2 replacement — zero Node.js dependencies, pure Bun performance.",
|
|
5
5
|
"main": "src/api.ts",
|
|
6
6
|
"module": "src/api.ts",
|
package/src/startup-manager.ts
CHANGED
|
@@ -34,39 +34,41 @@
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
private generateSystemd(bunPath: string, bm2Path: string, daemonPath: string): string {
|
|
37
|
+
|
|
37
38
|
const unit = `[Unit]
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
39
|
+
Description=BM2 Process Manager
|
|
40
|
+
Documentation=https://github.com/bm2
|
|
41
|
+
After=network.target
|
|
42
|
+
|
|
43
|
+
[Service]
|
|
44
|
+
Type=simple
|
|
45
|
+
User=${process.env.USER || "root"}
|
|
46
|
+
LimitNOFILE=infinity
|
|
47
|
+
LimitNPROC=infinity
|
|
48
|
+
LimitCORE=infinity
|
|
49
|
+
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${join(bunPath, "..")}
|
|
50
|
+
Environment=BM2_HOME=${join(process.env.HOME || "/root", ".bm2")}
|
|
51
|
+
Restart=on-failure
|
|
52
|
+
|
|
53
|
+
ExecStart=${bunPath} run ${daemonPath}
|
|
54
|
+
ExecStartPost=${bunPath} run ${bm2Path} resurrect
|
|
55
|
+
ExecReload=${bunPath} run ${bm2Path} reload all
|
|
56
|
+
ExecStop=${bunPath} run ${bm2Path} kill
|
|
57
|
+
|
|
58
|
+
[Install]
|
|
59
|
+
WantedBy=multi-user.target
|
|
60
|
+
`;
|
|
61
|
+
|
|
60
62
|
const servicePath = "/etc/systemd/system/bm2.service";
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
return `# BM2 Systemd Service
|
|
64
|
+
# Save to: ${servicePath}
|
|
65
|
+
# Then run:
|
|
66
|
+
# sudo systemctl daemon-reload
|
|
67
|
+
# sudo systemctl enable bm2
|
|
68
|
+
# sudo systemctl start bm2
|
|
69
|
+
|
|
70
|
+
${unit}`;
|
|
71
|
+
}
|
|
70
72
|
|
|
71
73
|
private generateLaunchd(bunPath: string, bm2Path: string, daemonPath: string): string {
|
|
72
74
|
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -115,11 +117,11 @@
|
|
|
115
117
|
if (os === "linux") {
|
|
116
118
|
const servicePath = "/etc/systemd/system/bm2.service";
|
|
117
119
|
// Extract just the unit content
|
|
118
|
-
const unitContent = content.split("\n\n").slice(1).join("\n\n");
|
|
119
|
-
await Bun.write(servicePath,
|
|
120
|
+
//const unitContent = content.split("\n\n").slice(1).join("\n\n");
|
|
121
|
+
await Bun.write(servicePath, content);
|
|
120
122
|
|
|
121
|
-
Bun.spawn(["sudo", "systemctl", "daemon-reload"], { stdout: "inherit" });
|
|
122
|
-
Bun.spawn(["sudo", "systemctl", "enable", "bm2"], { stdout: "inherit" });
|
|
123
|
+
Bun.spawn(["sudo", "systemctl", "daemon-reload"], { stdout: "inherit" }).exited;
|
|
124
|
+
Bun.spawn(["sudo", "systemctl", "enable", "bm2"], { stdout: "inherit" }).exited;
|
|
123
125
|
|
|
124
126
|
return `Service installed at ${servicePath}\nRun: sudo systemctl start bm2`;
|
|
125
127
|
} else if (os === "darwin") {
|