(&self)
| 37 | |
| 38 | impl ServiceManager for LinuxServiceManager { |
| 39 | fn install(&self) -> Result<()> { |
| 40 | // Copy config to system location |
| 41 | self.config.copy_config_to_system()?; |
| 42 | |
| 43 | // Create the service file |
| 44 | self.create_service_file()?; |
| 45 | |
| 46 | // Reload systemd to recognize the new service |
| 47 | Command::new("systemctl") |
| 48 | .args(["daemon-reload"]) |
| 49 | .status() |
| 50 | .context("Failed to reload systemd")?; |
| 51 | |
| 52 | // Enable the service to start on boot |
| 53 | Command::new("systemctl") |
| 54 | .args(["enable", &self.config.name]) |
| 55 | .status() |
| 56 | .context("Failed to enable service")?; |
| 57 | |
| 58 | Ok(()) |
| 59 | } |
| 60 | |
| 61 | fn uninstall(&self) -> Result<()> { |
| 62 | // Stop the service if it's running |
no test coverage detected