Expand description
Background process management for kasl watch: spawn detached,
track by PID file, stop, and the daemon’s own signal-handled entry
point.
use kasl::libs::daemon;
daemon::spawn()?; // Start background monitoring
daemon::stop()?; // Stop background monitoring
daemon::run_with_signal_handling().await?; // Run with signal handlingFunctions§
- is_
running - True when the PID file exists, parses, and names a live process.
- run_
with_ signal_ handling - The daemon entry point: runs the monitor and the Jira inbox poller, shutting both down on SIGTERM/SIGINT (Ctrl+C on Windows) and removing the PID file on the way out.
- spawn
- Re-launches the current executable detached (
--daemon-run), first stopping any daemon the PID file points at, and records the new PID. Detachment issetsidon Unix,CREATE_NO_WINDOWon Windows; a failed stop of the old daemon is a warning, not a blocker. - stop
- Stops the daemon; “already stopped” counts as success, so cleanup scripts can call it unconditionally.