systemctl
Small rust crate to interact with systemd units
Features
- serde: Enable to make structs in this crate De-/Serializable
Limitations
Currently SystemD Version <245 are not supported as unit-file-list changed from two column to three column setup. See: SystemD Changelog
Unit / service operation
Nominal service operations:
let systemctl = default;
systemctl.stop
.unwrap;
systemctl.restart
.unwrap;
if let Ok = systemctl.exists
Service enumeration
let systemctl = default;
// list all units
systemctl.list_units;
// list all services
// by adding a --type filter
systemctl.list_units;
// list all services currently `enabled`
// by adding a --state filter
systemctl.list_units;
// list all services starting with cron
systemctl.list_units;
Unit structure
Use the unit structure for more information
let systemctl = default;
let unit = systemctl.create_unit
.unwrap;
systemctl.restart.unwrap;
println!;
println!;
if let Some = unit.docs
println!;
println!;
println!;
println!;
println!;
TODO
- parse all known attributes in
from_systemctl