(&self)
| 59 | } |
| 60 | |
| 61 | fn uninstall(&self) -> Result<()> { |
| 62 | // Stop the service if it's running |
| 63 | let _ = self.stop(); |
| 64 | |
| 65 | // Disable the service |
| 66 | Command::new("systemctl") |
| 67 | .args(["disable", &self.config.name]) |
| 68 | .status() |
| 69 | .context("Failed to disable service")?; |
| 70 | |
| 71 | // Remove the service file |
| 72 | if Path::new(&self.service_file_path()).exists() { |
| 73 | fs::remove_file(self.service_file_path()).context("Failed to remove service file")?; |
| 74 | } |
| 75 | |
| 76 | // Reload systemd |
| 77 | Command::new("systemctl") |
| 78 | .args(["daemon-reload"]) |
| 79 | .status() |
| 80 | .context("Failed to reload systemd")?; |
| 81 | |
| 82 | Ok(()) |
| 83 | } |
| 84 | |
| 85 | fn start(&self) -> Result<()> { |
| 86 | Command::new("systemctl") |
no test coverage detected