fluxy-bot 0.5.39 → 0.5.40
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/bin/cli.js +18 -2
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -472,6 +472,21 @@ async function start() {
|
|
|
472
472
|
return init();
|
|
473
473
|
}
|
|
474
474
|
|
|
475
|
+
// If daemon is already running, don't start a second instance
|
|
476
|
+
if (os.platform() === 'linux' && isServiceInstalled() && isServiceActive()) {
|
|
477
|
+
banner();
|
|
478
|
+
const config = JSON.parse(fs.readFileSync(CONFIG_PATH, 'utf-8'));
|
|
479
|
+
console.log(`\n ${c.blue}●${c.reset} Fluxy is already running as a daemon.\n`);
|
|
480
|
+
if (config.relay?.url) {
|
|
481
|
+
console.log(` ${c.dim}URL:${c.reset} ${c.pink}${link(config.relay.url)}${c.reset}`);
|
|
482
|
+
}
|
|
483
|
+
console.log(` ${c.dim}Status:${c.reset} ${c.pink}fluxy daemon status${c.reset}`);
|
|
484
|
+
console.log(` ${c.dim}Logs:${c.reset} ${c.pink}fluxy daemon logs${c.reset}`);
|
|
485
|
+
console.log(` ${c.dim}Restart:${c.reset} ${c.pink}fluxy daemon restart${c.reset}`);
|
|
486
|
+
console.log(` ${c.dim}Stop:${c.reset} ${c.pink}fluxy daemon stop${c.reset}\n`);
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
|
|
475
490
|
const isLinux = os.platform() === 'linux';
|
|
476
491
|
const hasSystemd = isLinux && (() => { try { execSync('systemctl --version', { stdio: 'ignore' }); return true; } catch { return false; } })();
|
|
477
492
|
const needsDaemon = hasSystemd && !isServiceInstalled();
|
|
@@ -677,8 +692,9 @@ async function update() {
|
|
|
677
692
|
// Auto-restart daemon if installed
|
|
678
693
|
if (os.platform() === 'linux' && isServiceInstalled()) {
|
|
679
694
|
try {
|
|
680
|
-
|
|
681
|
-
|
|
695
|
+
const cmd = needsSudo() ? `sudo systemctl restart ${SERVICE_NAME}` : `systemctl restart ${SERVICE_NAME}`;
|
|
696
|
+
execSync(cmd, { stdio: 'inherit' });
|
|
697
|
+
console.log(`\n ${c.blue}✔${c.reset} Daemon restarted with new version.\n`);
|
|
682
698
|
} catch {
|
|
683
699
|
console.log(` ${c.yellow}⚠${c.reset} Could not restart daemon. Run ${c.pink}fluxy daemon restart${c.reset} manually.\n`);
|
|
684
700
|
}
|