#shutdown #reboot #cross-platform #api-bindings #system

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

#328 in Hardware support

Download history 6652/week @ 2024-06-20 8712/week @ 2024-06-27 8476/week @ 2024-07-04 7033/week @ 2024-07-11 4871/week @ 2024-07-18 7342/week @ 2024-07-25 10974/week @ 2024-08-01 8430/week @ 2024-08-08 7691/week @ 2024-08-15 12929/week @ 2024-08-22 12220/week @ 2024-08-29 11926/week @ 2024-09-05 9491/week @ 2024-09-12 9595/week @ 2024-09-19 11054/week @ 2024-09-26 10438/week @ 2024-10-03

42,248 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–44MB
~642K SLoC