dstat 0.0.2

[●◀] Query systemd units quickly from the command line.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
pub fn systemctl_is_active(service: &str) -> bool {
    use std::process::Command;
    let output = Command::new("systemctl")
        .args(["is-active", service])
        .output()
        .expect(&format!("Unknown service {}.", service));

    if output.status.code().unwrap() == 0 {
        return true;
    }
    false
}