add check for wastebin
This commit is contained in:
parent
2fd2cda4fe
commit
2129951dbf
1 changed files with 22 additions and 7 deletions
25
src/main.rs
25
src/main.rs
|
@ -23,17 +23,32 @@ fn main() {
|
||||||
println!("Authentication failed! {EMOJI_CROSS}");
|
println!("Authentication failed! {EMOJI_CROSS}");
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut channel = sess.channel_session().unwrap();
|
println!("-------------------------");
|
||||||
channel.exec("systemctl is-active gollum").unwrap();
|
let mut gollum_check = sess.channel_session().unwrap();
|
||||||
|
gollum_check.exec("systemctl is-active gollum").unwrap();
|
||||||
let mut s = String::new();
|
let mut s = String::new();
|
||||||
channel.read_to_string(&mut s).unwrap();
|
gollum_check.read_to_string(&mut s).unwrap();
|
||||||
channel.wait_close().unwrap();
|
gollum_check.wait_close().unwrap();
|
||||||
|
|
||||||
let exit_code = channel.exit_status().unwrap();
|
let exit_code = gollum_check.exit_status().unwrap();
|
||||||
|
|
||||||
if exit_code == 0 {
|
if exit_code == 0 {
|
||||||
println!("Gollum service is active {EMOJI_CHECK}");
|
println!("Gollum service is active {EMOJI_CHECK}");
|
||||||
} else {
|
} else {
|
||||||
println!("Gollum service is inactive {EMOJI_CROSS}(exit code: {})", exit_code);
|
println!("Gollum service is inactive {EMOJI_CROSS}(exit code: {})", exit_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut wastebin_check = sess.channel_session().unwrap();
|
||||||
|
wastebin_check.exec("systemctl is-active wastebin").unwrap();
|
||||||
|
let mut s = String::new();
|
||||||
|
wastebin_check.read_to_string(&mut s).unwrap();
|
||||||
|
wastebin_check.wait_close().unwrap();
|
||||||
|
|
||||||
|
let exit_code = wastebin_check.exit_status().unwrap();
|
||||||
|
|
||||||
|
if exit_code == 0 {
|
||||||
|
println!("Wastebin service is active {EMOJI_CHECK}");
|
||||||
|
} else {
|
||||||
|
println!("Wastebin service is inactive {EMOJI_CROSS}(exit code: {})", exit_code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue