pub fn spawn() -> Result<()>Expand description
Re-launches the current executable detached (--daemon-run), first
stopping any daemon the PID file points at, and records the new PID.
Detachment is setsid on Unix, CREATE_NO_WINDOW on Windows; a
failed stop of the old daemon is a warning, not a blocker.
use kasl::libs::daemon;
// Start background monitoring
daemon::spawn()?;
println!("Background monitoring started");