Skip to content

Commit 99feb5a

Browse files
authored
Merge pull request #10 from 51yu/delete-service
util function to delete systemd unit config file
2 parents 092cf8a + d879b6a commit 99feb5a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/utils.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,10 @@ pub fn create_unit_configuration_file(unit_name: &str, buffer: &[u8]) -> Result<
8585
writer.flush()?;
8686
Ok(())
8787
}
88+
89+
pub fn delete_unit_configuration_file(unit_name: &str) -> Result<()> {
90+
let mut path = std::path::PathBuf::from(SYSTEMD_UNIT_CONFIGURATION_DIRECTORY);
91+
path.push(unit_name);
92+
std::fs::remove_file(path.as_path())?;
93+
Ok(())
94+
}

0 commit comments

Comments
 (0)