|
35 | 35 |
|
36 | 36 | private generateSystemd(bunPath: string, bm2Path: string, daemonPath: string): string { |
37 | 37 | const unit = `[Unit] |
38 | | - Description=BM2 Process Manager |
39 | | - Documentation=https://github.com/bm2 |
40 | | - After=network.target |
41 | | - |
42 | | - [Service] |
43 | | - Type=forking |
44 | | - User=${process.env.USER || "root"} |
45 | | - LimitNOFILE=infinity |
46 | | - LimitNPROC=infinity |
47 | | - LimitCORE=infinity |
48 | | - Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${join(bunPath, "..")} |
49 | | - Environment=BM2_HOME=${join(process.env.HOME || "/root", ".bm2")} |
50 | | - PIDFile=${join(process.env.HOME || "/root", ".bm2", "daemon.pid")} |
51 | | - Restart=on-failure |
52 | | - |
53 | | - ExecStart=${bunPath} run ${daemonPath} |
54 | | - ExecReload=${bunPath} run ${bm2Path} reload all |
55 | | - ExecStop=${bunPath} run ${bm2Path} kill |
56 | | - |
57 | | - [Install] |
58 | | - WantedBy=multi-user.target`; |
59 | | - |
| 38 | + Description=BM2 Process Manager |
| 39 | + Documentation=https://github.com/bm2 |
| 40 | + After=network.target |
| 41 | + |
| 42 | + [Service] |
| 43 | + Type=simple |
| 44 | + User=${process.env.USER || "root"} |
| 45 | + LimitNOFILE=infinity |
| 46 | + LimitNPROC=infinity |
| 47 | + LimitCORE=infinity |
| 48 | + Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${join(bunPath, "..")} |
| 49 | + Environment=BM2_HOME=${join(process.env.HOME || "/root", ".bm2")} |
| 50 | + Restart=on-failure |
| 51 | + |
| 52 | + ExecStart=${bunPath} run ${daemonPath} |
| 53 | + ExecStartPost=${bunPath} run ${bm2Path} resurrect |
| 54 | + ExecReload=${bunPath} run ${bm2Path} reload all |
| 55 | + ExecStop=${bunPath} run ${bm2Path} kill |
| 56 | + |
| 57 | + [Install] |
| 58 | + WantedBy=multi-user.target`; |
| 59 | + |
60 | 60 | const servicePath = "/etc/systemd/system/bm2.service"; |
61 | 61 | return `# BM2 Systemd Service |
62 | | - # Save to: ${servicePath} |
63 | | - # Then run: |
64 | | - # sudo systemctl daemon-reload |
65 | | - # sudo systemctl enable bm2 |
66 | | - # sudo systemctl start bm2 |
67 | | - |
68 | | - ${unit}`; |
| 62 | + # Save to: ${servicePath} |
| 63 | + # Then run: |
| 64 | + # sudo systemctl daemon-reload |
| 65 | + # sudo systemctl enable bm2 |
| 66 | + # sudo systemctl start bm2 |
| 67 | + |
| 68 | + ${unit}`; |
69 | 69 | } |
70 | 70 |
|
71 | 71 | private generateLaunchd(bunPath: string, bm2Path: string, daemonPath: string): string { |
|
0 commit comments