tried to pass hddtemp executable

This commit is contained in:
Nickiel12 2023-08-25 22:56:42 -07:00
parent 5ddc4274c8
commit cb4def2aee
2 changed files with 7 additions and 3 deletions

View file

@ -98,7 +98,7 @@ rust-project TODO: write shell script for automatically updating `cargoHash`
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
ExecStart = '' ExecStart = ''
${cfg.package}/bin/status_cloud --config-file ${builtins.toString cfg.config_path} ${cfg.package}/bin/status_cloud --hddtemp-executable ${pkg.hddtemp} --config-file ${builtins.toString cfg.config_path}
''; '';
}; };
}; };

View file

@ -60,10 +60,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
} }
} }
match Command::new("hddtemp").output() { match Command::new(args.hddtemp_executable.clone()).output() {
Ok(val) => val, Ok(val) => val,
Err(e) => { Err(e) => {
println!("Error running hddtemp at all: {}", e.to_string()); println!("Error running hddtemp at all: {}", e.to_string());
println!("hddtemp = {}", args.hddtemp_executable.clone());
return Ok(()); return Ok(());
} }
}; };
@ -72,7 +73,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut drive_temps: Vec<String> = vec![]; let mut drive_temps: Vec<String> = vec![];
for drive in drives { for drive in drives {
let output = match Command::new("hddtemp").arg(drive.clone()).output() { let output = match Command::new(args.hddtemp_executable.clone()).arg(drive.clone()).output() {
Ok(val) => val, Ok(val) => val,
Err(e) => { Err(e) => {
println!("Error running hddtemp: {}", e.to_string()); println!("Error running hddtemp: {}", e.to_string());
@ -154,4 +155,7 @@ struct CliArgs {
/// Path to config .toml file /// Path to config .toml file
#[arg(short, long)] #[arg(short, long)]
config_file: String, config_file: String,
#[arg(short, long)]
hddtemp_executable: String,
} }