Crate sal_zinit_client

Crate sal_zinit_client 

Source
Expand description

SAL Zinit Client

This crate provides a Rust interface for interacting with a Zinit process supervisor daemon. Zinit is a process and service manager for Linux systems, designed for simplicity and robustness.

§Features

  • Async operations using tokio
  • Unix socket communication with Zinit daemon
  • Global client instance management
  • Comprehensive service management (start, stop, restart, monitor, etc.)
  • Service configuration management (create, delete, get)
  • Log retrieval from Zinit
  • Rhai scripting integration

§Example

use sal_zinit_client::{list, status};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let socket_path = "/var/run/zinit.sock";
     
    // List all services
    let services = list(socket_path).await?;
    println!("Services: {:?}", services);
     
    // Get status of a specific service
    if let Some(service_name) = services.keys().next() {
        let status = status(socket_path, service_name).await?;
        println!("Status: {:?}", status);
    }
     
    Ok(())
}

Modules§

rhai
Rhai wrappers for Zinit client module functions

Structs§

ZinitClientWrapper

Functions§

create_service
create_service_full
delete_service
forget
get_service
get_zinit_client
kill
list
logs
monitor
reboot
reset
restart
start
status
stop