Module Stdune.Daemonize

Start, stop and synchronize with a daemon

type status =
| Started of {
daemon_info : string;
pid : Pid.t;
}

The daemon was started in the background with the given daemon_info and pid.

| Already_running of {
daemon_info : string;
pid : Pid.t;
}

The daemon is already running in the background with the given daemon_info and pid.

| Finished

The daemon was run synchronously and exited.

Result of a daemonization

val daemonize : ?⁠workdir:Path.t -> ?⁠foreground:bool -> Path.t -> ((daemon_info:string -> unit) -> unit) -> (status, string) Result.t
val stop : Path.t -> (unit, string) Result.t