2 Commits
Author SHA1 Message Date
agessaman 6ce2e597bd fix(service): wait for the instance lock instead of exiting under systemd
A service that found another instance running (a manual run during maintenance) exited three times inside the start limit and stayed failed after the other instance stopped. The new --wait-for-lock flag retries the single-instance lock every 5 seconds instead of exiting 1, announcing the wait once, and resolves db_path on every attempt so an edit during the wait is honored. The systemd unit and the Debian package's unit start the bot with it.
2026-11-14 08:45:02 -08:00
agessaman 317b1a2a56 fix(core): refuse to start a second instance on the same database
Two bots on one radio evict each other from single-client companion servers such as openhop, which closes the older connection when a new one arrives. Each instance then reconnects and evicts the other in an endless loop.

Startup now takes an advisory lock on <db_path>.lock beside the bot database and exits 1 with the holder's PID when it is already held. The OS releases the lock on any exit, so a killed bot leaves nothing stale. The lock is taken before a pending restore is applied, so a second launch cannot replace the database under a running bot. A lock file that cannot be created is only a warning.
2026-11-13 05:58:47 -08:00