add start, stop, reload and restart LSB compatible commands.

This commit is contained in:
primardj 2024-05-18 15:36:35 +01:00
parent 1a21c67c6d
commit c4ab2e3777
2 changed files with 15 additions and 1 deletions

View file

@ -57,6 +57,20 @@ pub fn sent_signal( svwait_var: i32, verbose: i8, command: &str, mut sv: status_
}, },
"e" | "x" => { "e" | "x" => {
return misc::exit_verbose(sv.sent_signal(b"x"), verbose, svwait_var, sv); return misc::exit_verbose(sv.sent_signal(b"x"), verbose, svwait_var, sv);
// TODO: Erreur quand le service est déjà exité, et que l'on essaie de le réexiter.
// Solution: retirer le test "e" et "x" pour avant la création de l'objet.
},
"start" => {
return misc::run_verbose(sv.sent_signal(b"u"), true, 1, svwait_var, sv);
},
"stop" => {
return misc::run_verbose(sv.sent_signal(b"d"), false, 1, svwait_var, sv);
},
"reload" => {
return misc::noexcept_verbose(sv.sent_signal(b"h"), 1, sv);
},
"restart" => {
return misc::run_verbose(sv.sent_signal(b"tcu"), true, 1, svwait_var, sv);
}, },
other => { other => {
println!("Error, command {} not implemented.", other); // TODO : Put the real error println!("Error, command {} not implemented.", other); // TODO : Put the real error

View file

@ -35,7 +35,7 @@ pub fn run_verbose(sent_signal: bool, expected: bool, verbose: i8, svwait_var: i
if status == 1 { if status == 1 {
return 1; return 1;
} }
if sv.is_up() == expected { if sv.is_up() == expected && sv.is_term() == false {
println!("ok: {}", sv.get_status_string()); println!("ok: {}", sv.get_status_string());
return 0 return 0
} }