10 stable releases (3 major)

Uses new Rust 2024

4.1.0 Jan 17, 2026
4.0.1 Jan 13, 2023
4.0.0 Nov 28, 2022
3.0.0 Dec 19, 2019
1.0.2 Dec 17, 2019

#53 in Hardware support

Download history 30647/week @ 2025-12-11 33823/week @ 2025-12-18 32230/week @ 2025-12-25 39871/week @ 2026-01-01 39052/week @ 2026-01-08 39183/week @ 2026-01-15 37963/week @ 2026-01-22 40547/week @ 2026-01-29 35071/week @ 2026-02-05 33874/week @ 2026-02-12 35683/week @ 2026-02-19 46769/week @ 2026-02-26 36645/week @ 2026-03-05 43208/week @ 2026-03-12 41152/week @ 2026-03-19 43940/week @ 2026-03-26

171,536 downloads per month
Used in 7 crates

MIT/Apache

28KB
626 lines

system_shutdown

CI/CD Crates.io Documentation License

system_shutdown provides a cross platform way to shut down, reboot or log out operations.

Supported platforms: Linux, Windows and macOS.

Usage

Add this to your Cargo.toml:

[dependencies]
system_shutdown = "*"

and then:

use system_shutdown::shutdown;

fn main() {
    match shutdown() {
        Ok(_) => println!("Shutting down, bye!"),
        Err(error) => eprintln!("Failed to shut down: {}", error),
    }
}

In most of the systems it does not requires the user to be root/admin.

Contributions

Pull Requests are welcome! =)

License

system_shutdown is licensed under either of the following, at your option:

Dependencies

~0–35MB
~596K SLoC