add check for wastebin
This commit is contained in:
parent
2fd2cda4fe
commit
2129951dbf
1 changed files with 22 additions and 7 deletions
29
src/main.rs
29
src/main.rs
|
@ -16,24 +16,39 @@ fn main() {
|
|||
|
||||
// Try to authenticate with the first identity in the agent.
|
||||
sess.userauth_agent(USER).unwrap();
|
||||
|
||||
|
||||
if sess.authenticated() {
|
||||
println!("Authentication successful! {EMOJI_CHECK}");
|
||||
} else {
|
||||
println!("Authentication failed! {EMOJI_CROSS}");
|
||||
}
|
||||
|
||||
let mut channel = sess.channel_session().unwrap();
|
||||
channel.exec("systemctl is-active gollum").unwrap();
|
||||
|
||||
println!("-------------------------");
|
||||
let mut gollum_check = sess.channel_session().unwrap();
|
||||
gollum_check.exec("systemctl is-active gollum").unwrap();
|
||||
let mut s = String::new();
|
||||
channel.read_to_string(&mut s).unwrap();
|
||||
channel.wait_close().unwrap();
|
||||
gollum_check.read_to_string(&mut s).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 {
|
||||
println!("Gollum service is active {EMOJI_CHECK}");
|
||||
} else {
|
||||
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