Skip to main content

ServiceManager

Trait ServiceManager 

Source
pub trait ServiceManager: Send + Sync {
    // Required methods
    fn install(&self, config: &ServiceConfig) -> Result<InstallResult>;
    fn uninstall(&self) -> Result<()>;
    fn is_installed(&self) -> Result<bool>;
    fn service_file_path(&self) -> PathBuf;
    fn service_name(&self) -> &str;
}
Expand description

Trait for platform-specific service managers

Implementations handle the details of registering services with systemd (Linux) or launchd (macOS).

Required Methods§

Source

fn install(&self, config: &ServiceConfig) -> Result<InstallResult>

Install the service with the given configuration

Creates the service file and registers it with the init system. Also starts the service immediately after registration.

Source

fn uninstall(&self) -> Result<()>

Uninstall the service

Stops the service if running and removes the registration.

Source

fn is_installed(&self) -> Result<bool>

Check if the service is currently installed

Source

fn service_file_path(&self) -> PathBuf

Get the path to the service file

Source

fn service_name(&self) -> &str

Get the service name

Implementors§