{"id":34672333,"url":"https://github.com/houseme/win-service-rs","last_synced_at":"2026-04-24T10:33:02.256Z","repository":{"id":301901198,"uuid":"1010620214","full_name":"houseme/win-service-rs","owner":"houseme","description":"A Rust library for Windows service management using windows-rs","archived":false,"fork":false,"pushed_at":"2025-09-01T01:45:29.000Z","size":41,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-26T08:47:42.284Z","etag":null,"topics":["rust","windows"],"latest_commit_sha":null,"homepage":"https://houseme.github.io/win-service-rs/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/houseme.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-29T13:13:24.000Z","updated_at":"2025-11-28T07:38:26.000Z","dependencies_parsed_at":"2025-12-24T20:00:12.820Z","dependency_job_id":null,"html_url":"https://github.com/houseme/win-service-rs","commit_stats":null,"previous_names":["houseme/win-service-rs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/houseme/win-service-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houseme%2Fwin-service-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houseme%2Fwin-service-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houseme%2Fwin-service-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houseme%2Fwin-service-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/houseme","download_url":"https://codeload.github.com/houseme/win-service-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houseme%2Fwin-service-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32219015,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T10:26:35.452Z","status":"ssl_error","status_checked_at":"2026-04-24T10:25:27.643Z","response_time":64,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rust","windows"],"created_at":"2025-12-24T20:00:05.735Z","updated_at":"2026-04-24T10:33:02.239Z","avatar_url":"https://github.com/houseme.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RustFS Manager \u0026 win-service-rs\n\nEnglish｜[中文](README_zh.md)\n\n## Project Overview\n\n`rustfs-manager` is a Windows service management tool developed in Rust, built on top of the `win-service-rs` library,\ndesigned to provide functionality similar to Linux's `systemctl`. It manages the lifecycle of `rustfs.exe` or similar\nservices, supporting operations such as installation, starting, stopping, status querying, and uninstallation.\n`win-service-rs` is a standalone Rust crate that encapsulates the Windows Service Control Manager (SCM) APIs, offering a\nsafe and user-friendly interface for any Windows service management needs.\n\nThis project leverages Rust's memory safety and the robust capabilities of `windows-rs` to deliver an efficient and\nreliable service management solution. Whether for enterprise applications or automation scripts, `rustfs-manager` and\n`win-service-rs` provide flexible support.\n\n## Features\n\n- **Service Management**: Supports installation, starting, stopping, status querying, and uninstallation of services.\n- **Configuration Management**: Dynamically configure service parameters (e.g., service name, executable path) via TOML\n  files.\n- **Structured Logging**: Uses `tracing` to output JSON-formatted logs, facilitating integration with ELK or Graylog.\n- **Asynchronous Support**: Provides async interfaces via `tokio` for high-concurrency scenarios.\n- **Safety**: Built on `windows-rs` safe bindings, ensuring memory safety and reliable operations.\n- **Production Optimization**: Includes PowerShell deployment scripts for automated deployment.\n\n## Installation\n\n1. **Install Rust**:\n   Ensure the Rust toolchain is installed and updated to the latest stable version:\n   ```bash\n   rustup update stable\n   ```\n\n2. **Clone the Project**:\n   ```bash\n   git clone https://github.com/houseme/win-service-rs.git\n   cd win-service-rs/examples/rustfs_manager\n   ```\n\n3. **Install Dependencies**:\n   Dependencies are specified in `Cargo.toml`. Build the project with:\n   ```bash\n   cargo build --release\n   ```\n\n4. **Configure Environment**:\n   Edit `config/config.toml` to update parameters like `exe_path`, ensuring the `rustfs.exe` path is valid.\n\n## Usage\n\n`rustfs-manager` provides a command-line interface (CLI) with the following commands:\n\n- **Install Service**:\n  ```bash\n  cargo run -- install\n  ```\n  Registers `rustfs.exe` as a Windows service.\n\n- **Start Service**:\n  ```bash\n  cargo run -- start\n  ```\n\n- **Stop Service**:\n  ```bash\n  cargo run -- stop\n  ```\n\n- **Query Status**:\n  ```bash\n  cargo run -- status\n  ```\n\n- **Uninstall Service**:\n  ```bash\n  cargo run -- uninstall\n  ```\n\nRun `cargo run -- --help` to see the full list of commands.\n\n## Deployment Guide\n\n1. **Build Production Binary**:\n   ```bash\n   cargo build --release\n   ```\n\n2. **Copy Files**:\n   Copy `target/release/rustfs-manager.exe` and `config/config.toml` to the target server.\n\n3. **Run Deployment Script**:\n   Use the provided PowerShell script for automated deployment:\n   ```powershell\n   .\\scripts\\deploy.ps1\n   ```\n\n4. **Verify Deployment**:\n   Check service status:\n   ```powershell\n   sc query RustFSManager\n   ```\n\n## win-service-rs Usage\n\n`win-service-rs` is a standalone Rust crate that encapsulates Windows SCM APIs, providing a safe and user-friendly\ninterface for service management. Here's how to use it:\n\n1. **Add Dependency**:\n   Add to your `Cargo.toml`:\n   ```toml\n   [dependencies]\n   win-service-rs = { version = \"0.1.0\", features = [\"async\"] }\n   ```\n\n2. **Example Code**:\n   ```rust\n   use win_service_rs::{ServiceConfig, ServiceManager, StartType};\n\n   #[tokio::main]\n   async fn main() -\u003e Result\u003c(), win_service_rs::Error\u003e {\n       let mut manager = ServiceManager::new(\"RustFS\")?;\n       let config = ServiceConfig::new(\n           \"C:\\\\path\\\\to\\\\rustfs.exe\".to_string(),\n           \"RustFS Service\".to_string(),\n       )\n       .with_description(\"RustFS File System Service\".to_string())\n       .with_start_type(StartType::Demand);\n\n       manager.install(\u0026config)?;\n       manager.async_start().await?;\n       let status = manager.async_status().await?;\n       println!(\"Service status: {:?}\", status);\n       manager.async_stop().await?;\n       manager.uninstall()?;\n       Ok(())\n   }\n   ```\n\n3. **Asynchronous Support**:\n   With the `async` feature enabled, use `async_start`, `async_stop`, and `async_status` methods for high-concurrency\n   scenarios.\n\n4. **Error Handling**:\n   The crate provides a custom `Error` type to handle SCM errors (e.g., access denied, service not found).\n\n## Notes\n\n- **Permissions**: Running `rustfs-manager` or `win-service-rs` requires administrator privileges.\n- **Log Integration**: Redirect `tracing` JSON logs to files for integration with ELK or Graylog.\n- **Security**: Restrict file permissions for `rustfs.exe` and `rustfs-manager` to prevent unauthorized access.\n- **Extensibility**: Extend `win-service-rs` with features like log monitoring or health checks.\n\n## References\n\n1. **windows-rs Resources**:\n    - [GitHub: windows-rs](https://github.com/microsoft/windows-rs)\n    - [Rust for Windows Documentation](https://learn.microsoft.com/en-us/windows/dev-environment/rust/rust-for-windows)\n2. **Windows API Documentation**:\n    - [OpenSCManager](https://learn.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-openscmanagerw)\n    - [CreateService](https://learn.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-createservicew)\n    - [StartService](https://learn.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-startservicew)\n    - [Service Control Manager](https://learn.microsoft.com/en-us/windows/win32/services/service-control-manager)\n3. **Rust Ecosystem**:\n    - [Rust Official Documentation](https://www.rust-lang.org/)\n    - [Tokio Documentation](https://tokio.rs/docs/tokio/)\n    - [Clap Documentation](https://docs.rs/clap/latest/clap/)\n    - [Serde Documentation](https://serde.rs/)\n    - [Config Documentation](https://docs.rs/config/latest/config/)\n    - [Tracing Documentation](https://docs.rs/tracing/latest/tracing/)\n\n## License\n\nThis project is licensed under the MIT ,Apache License. See the `LICENSE-APACHE`,`LICENSE-MIT` file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhouseme%2Fwin-service-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhouseme%2Fwin-service-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhouseme%2Fwin-service-rs/lists"}