Skip to content

Commit

Permalink
optimize install
Browse files Browse the repository at this point in the history
  • Loading branch information
GenshinMinecraft committed Dec 8, 2024
1 parent a487c8e commit d836aca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
22 changes: 2 additions & 20 deletions src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,25 +277,7 @@ pub fn install_to_openrc(args: Args) {
}
}

match Command::new("rc-service")
.arg("akile_monitor_client_rs")
.arg("start")
.output()
{
Ok(tmp) => {
if tmp.status.success() {
info!("服务安装完成, 成功启动服务");
exit(0);
} else {
error!("无法启动服务");
exit(1);
}
}
Err(e) => {
error!("无法启动服务: {}", e);
exit(1);
}
}
warn!("请手动执行 `rc-service akile_monitor_client_rs start`!")
}

pub fn uninstall_from_openrc() {
Expand Down Expand Up @@ -353,7 +335,7 @@ pub fn uninstall_from_openrc() {
exit(1);
}

static SERVICE_TEMPLATE_OPENRC: &str = r#"#!/sbin/openrc-run
const SERVICE_TEMPLATE_OPENRC: &str = r#"#!/sbin/openrc-run
command=/usr/bin/ak_monitor_client_rs
command_args="COMMAND_ARGS"
Expand Down
5 changes: 3 additions & 2 deletions src/manage_utils.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// For Install / Uninstall
use crate::args::Args;
use log::{error, info, warn};
use std::fs::File;
Expand Down Expand Up @@ -70,7 +71,7 @@ pub fn check_installed(service_path: &str) {
}

pub fn generate_client_args(args: Args) -> String {
return format!(
format!(
"--debug {} --tls {} -n \"{}\" -s \"{}\" -a \"{}\" -i {} -f {} --monitor-path \"{}\"",
args.debug,
args.tls,
Expand All @@ -80,7 +81,7 @@ pub fn generate_client_args(args: Args) -> String {
args.interval,
args.fake_times,
args.monitor_path
);
)
}

pub fn copy_binary() {
Expand Down

0 comments on commit d836aca

Please sign in to comment.