#systemd #service #process #transient #running #manager #async

systemd-run

A Rust crate for running processes as Systemd transient services

8 breaking releases

0.9.0 Nov 6, 2024
0.7.1 Feb 22, 2024
0.6.0 Dec 1, 2023
0.5.0 Nov 27, 2023
0.2.0 Jul 14, 2022

#412 in Unix APIs

Download history 5/week @ 2024-11-18 120/week @ 2024-12-02 33/week @ 2024-12-09 12/week @ 2024-12-16 19/week @ 2024-12-23 15/week @ 2025-01-06 16/week @ 2025-01-13 7/week @ 2025-01-20 27/week @ 2025-02-03 12/week @ 2025-02-10 42/week @ 2025-02-17 10/week @ 2025-02-24 14/week @ 2025-03-03

79 downloads per month

MIT/Apache

71KB
1.5K SLoC

Rust 1K SLoC // 0.0% comments C 136 SLoC // 0.1% comments C++ 37 SLoC

Contains (ELF exe/lib, 18KB) test-aux/setuid

systemd_run

This is the crate for running processes as Systemd transient services.

Status: Highly unstable, at early development cycle.

Example code

This code starts /bin/true as a Systemd transient service, running in the per-user service manager of your login session, and wait for it to finish.

#[async_std::main]
async fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
	let status = systemd_run::RunUser::new("/bin/true")
		.start()
		.await?
		.wait()
		.await?;
	dbg!(status);
	Ok(())
}

Dependencies

~10–20MB
~322K SLoC