MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / installLinux

Function installLinux

apps/cli/src/daemon/service.ts:217–239  ·  view source on GitHub ↗
(options: ServiceInstallOptions)

Source from the content-addressed store, hash-verified

215}
216
217function installLinux(options: ServiceInstallOptions): void {
218 fs.mkdirSync(SYSTEMD_DIR, { recursive: true })
219 fs.mkdirSync(path.join(SYSTEM_DIR, 'logs'), { recursive: true })
220
221 fs.writeFileSync(SYSTEMD_SERVICE, buildUnit(options))
222
223 try {
224 execSync('systemctl --user daemon-reload', { stdio: 'pipe' })
225 execSync('systemctl --user enable --now chatlab.service', { stdio: 'pipe' })
226 } catch (err) {
227 throw new Error(`systemctl failed: ${err instanceof Error ? err.message : err}`)
228 }
229
230 const port = options.port ?? 3110
231 const host = options.host ?? '127.0.0.1'
232 writeMeta({ port, host, installedAt: new Date().toISOString() })
233
234 console.log(`\nChatLab is now running as a system service`)
235 console.log(` API: http://${host}:${port}`)
236 console.log(` Logs: ${LOG_FILE}`)
237 console.log(` Unit: ${SYSTEMD_SERVICE} (systemd)`)
238 console.log(`\nAuto-starts on login. Use \`chatlab stop\` to remove.\n`)
239}
240
241function uninstallLinux(): void {
242 if (!fs.existsSync(SYSTEMD_SERVICE)) {

Callers 1

serviceInstallFunction · 0.85

Calls 2

buildUnitFunction · 0.85
writeMetaFunction · 0.70

Tested by

no test coverage detected