server-manager 5.0.12

server-manager is a rust library for managing server processes. It encapsulates service startup, shutdown, and background daemon mode. Users can specify the PID file, log file paths, and other configurations through custom settings, while also passing in their own asynchronous server function for execution. The library supports both synchronous and asynchronous operations. On Unix and Windows platforms, it enables background daemon processes.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::*;

/// Main structure for managing server processes.
#[derive(Clone)]
pub struct ServerManager {
    /// Path to the PID file for process tracking.
    pub(crate) pid_file: String,
    /// An asynchronous function to be called before stopping the server.
    pub(crate) stop_hook: ServerManagerHook,
    /// An asynchronous function to be called before starting the server.
    pub(crate) start_hook: ServerManagerHook,
    /// Server function to be executed.
    pub(crate) server_hook: ServerManagerHook,
}