server-manager
server-manageris a Rust library for managing server processes. It encapsulates service startup, shutdown, and background daemon mode. Users can specify the PID file, log file paths, and other configurations through custom settings, while also passing in their own asynchronous server function for execution. The library supports both synchronous and asynchronous operations. On Unix and Windows platforms, it enables background daemon processes.
Installation
To use this crate, you can run cmd:
cargo add server-manager
Use
use *;
use fs;
use Duration;
let pid_file: String = "./process/test_pid.pid".to_string;
let _ = remove_file;
let config: ServerManagerConfig = ServerManagerConfig ;
let dummy_server = ;
let manager = new;
let res: = manager.start_daemon;
println!;
let res: = manager.stop;
println!;
manager.start.await;
let _ = remove_file;
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
Contact
For any inquiries, please reach out to the author at ltpp-universe root@ltpp.vip.