add emojis and systemctl active check test

This commit is contained in:
Aaron Honeycutt 2025-07-03 18:25:31 -06:00
parent 82f553d712
commit 2fd2cda4fe
3 changed files with 25 additions and 2 deletions

View file

@ -1,5 +1,7 @@
use std::io::prelude::*;
use std::net::TcpStream;
use ssh2::Session;
use emojis_rs::*;
const USER: &str = "aaronh";
const EDI: &str = "100.94.173.5:22";
@ -16,9 +18,22 @@ fn main() {
sess.userauth_agent(USER).unwrap();
if sess.authenticated() {
println!("Authentication successful!");
println!("Authentication successful! {EMOJI_CHECK}");
} else {
println!("Authentication failed!");
println!("Authentication failed! {EMOJI_CROSS}");
}
let mut channel = sess.channel_session().unwrap();
channel.exec("systemctl is-active gollum").unwrap();
let mut s = String::new();
channel.read_to_string(&mut s).unwrap();
channel.wait_close().unwrap();
let exit_code = channel.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);
}
}