#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

#96 in Hardware support

Download history 11354/week @ 2024-09-28 11862/week @ 2024-10-05 11832/week @ 2024-10-12 11121/week @ 2024-10-19 12354/week @ 2024-10-26 14629/week @ 2024-11-02 12473/week @ 2024-11-09 12659/week @ 2024-11-16 12230/week @ 2024-11-23 17209/week @ 2024-11-30 15286/week @ 2024-12-07 14955/week @ 2024-12-14 10890/week @ 2024-12-21 21584/week @ 2024-12-28 12556/week @ 2025-01-04 10042/week @ 2025-01-11

56,635 downloads per month
Used in 3 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–43MB
~594K SLoC