https://github.com/risoflora/system_shutdown
Rust library to shut down, reboot or log out the system.
https://github.com/risoflora/system_shutdown
reboot rust shutdown system
Last synced: about 1 year ago
JSON representation
Rust library to shut down, reboot or log out the system.
- Host: GitHub
- URL: https://github.com/risoflora/system_shutdown
- Owner: risoflora
- License: apache-2.0
- Created: 2019-12-17T14:37:37.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-04-01T15:23:14.000Z (about 1 year ago)
- Last Synced: 2025-05-15T02:18:25.533Z (about 1 year ago)
- Topics: reboot, rust, shutdown, system
- Language: Rust
- Homepage: https://crates.io/crates/system_shutdown
- Size: 61.5 KB
- Stars: 66
- Watchers: 7
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# `system_shutdown`
[![CI/CD][ci-cd-badge]][ci-cd-url]
[![Crates.io][crates-badge]][crates-url]
[![Documentation][docs-badge]][docs-url]
[![License][license-badge]][license-url]
`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`:
```ini
[dependencies]
system_shutdown = "*"
```
and then:
```rust
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:
- [Apache License 2.0](LICENSE-APACHE)
- [MIT License](LICENSE-MIT)
[ci-cd-badge]: https://github.com/risoflora/system_shutdown/actions/workflows/CI.yml/badge.svg
[ci-cd-url]: https://github.com/risoflora/system_shutdown/actions/workflows/CI.yml
[crates-badge]: https://img.shields.io/crates/v/system_shutdown.svg
[crates-url]: https://crates.io/crates/system_shutdown
[docs-badge]: https://docs.rs/system_shutdown/badge.svg
[docs-url]: https://docs.rs/system_shutdown
[license-badge]: https://img.shields.io/crates/l/system_shutdown.svg
[license-url]: https://github.com/risoflora/system_shutdown#license