Change sbot.rs to use configurable go-sbot service name
This commit is contained in:
parent
9f6ba14123
commit
5147eed497
|
@ -3,7 +3,6 @@ use std::{
|
||||||
error::Error,
|
error::Error,
|
||||||
fs,
|
fs,
|
||||||
fs::File,
|
fs::File,
|
||||||
io,
|
|
||||||
io::prelude::*,
|
io::prelude::*,
|
||||||
path::Path,
|
path::Path,
|
||||||
process::{Command, Output},
|
process::{Command, Output},
|
||||||
|
@ -25,12 +24,13 @@ use crate::{error::PeachWebError, utils::sbot};
|
||||||
// SBOT HELPER FUNCTIONS
|
// SBOT HELPER FUNCTIONS
|
||||||
|
|
||||||
/// Executes a systemctl command for the go-sbot.service process.
|
/// Executes a systemctl command for the go-sbot.service process.
|
||||||
pub fn systemctl_sbot_cmd(cmd: &str) -> io::Result<Output> {
|
pub fn systemctl_sbot_cmd(cmd: &str) -> Result<Output, PeachWebError> {
|
||||||
Command::new("sudo")
|
let output = Command::new("sudo")
|
||||||
.arg("systemctl")
|
.arg("systemctl")
|
||||||
.arg(cmd)
|
.arg(cmd)
|
||||||
.arg("go-sbot.service")
|
.arg(get_config_value("GO_SBOT_SERVICE")?)
|
||||||
.output()
|
.output()?;
|
||||||
|
Ok(output)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Executes a systemctl stop command followed by start command.
|
/// Executes a systemctl stop command followed by start command.
|
||||||
|
|
Loading…
Reference in New Issue