#system #shutdown #reboot

system_shutdown

Rust library for shut down, reboot or log out operations

9 stable releases (3 major)

4.0.1 Jan 13, 2023
4.0.0 Nov 28, 2022
3.0.0 Dec 19, 2019
2.1.0 Dec 18, 2019
1.0.2 Dec 17, 2019

#106 in Unix APIs

Download history 15519/week @ 2023-08-08 15043/week @ 2023-08-15 15244/week @ 2023-08-22 13157/week @ 2023-08-29 11770/week @ 2023-09-05 10706/week @ 2023-09-12 12793/week @ 2023-09-19 10791/week @ 2023-09-26 12393/week @ 2023-10-03 11377/week @ 2023-10-10 10671/week @ 2023-10-17 10469/week @ 2023-10-24 11292/week @ 2023-10-31 11636/week @ 2023-11-07 12747/week @ 2023-11-14 11123/week @ 2023-11-21

48,504 downloads per month
Used in 2 crates

MIT/Apache

27KB
618 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]
lock_keys = "*"

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–54MB
~783K SLoC