rename application
This commit is contained in:
parent
f2a26baf97
commit
e8b61d2caa
3 changed files with 19 additions and 17 deletions
16
src/main.rs
16
src/main.rs
|
@ -10,9 +10,11 @@ use emojis_rs::*;
|
|||
#[derive(Parser, Debug)]
|
||||
#[command(version, about, long_about = None)]
|
||||
struct Args {
|
||||
/// user needs access to systemd
|
||||
#[arg(short, long)]
|
||||
username: String,
|
||||
user: String,
|
||||
|
||||
/// include port number :22
|
||||
#[arg(short, long)]
|
||||
ip: String,
|
||||
}
|
||||
|
@ -25,18 +27,18 @@ fn main() {
|
|||
sess.set_tcp_stream(tcp);
|
||||
sess.handshake().expect("SSH handshake failed");
|
||||
|
||||
sess.userauth_agent(&args.username).expect("SSH authentication failed");
|
||||
sess.userauth_agent(&args.user).expect("SSH authentication failed");
|
||||
|
||||
if sess.authenticated() {
|
||||
println!("Authentication successful! {EMOJI_CHECK}");
|
||||
println!("{EMOJI_CHECK} Authentication successful!");
|
||||
} else {
|
||||
println!("Authentication failed! {EMOJI_CROSS}");
|
||||
println!("{EMOJI_CROSS} Authentication failed!");
|
||||
return;
|
||||
}
|
||||
|
||||
println!("-------------------------");
|
||||
|
||||
for service in ["gollum", "wastebin", "hydra-server"] {
|
||||
for service in ["forgejo", "gollum", "hydra-server", "syncthing", "wastebin"] {
|
||||
check_service_status(&sess, service);
|
||||
}
|
||||
}
|
||||
|
@ -52,9 +54,9 @@ fn check_service_status(sess: &Session, service: &str) {
|
|||
let exit_code = channel.exit_status().expect("Failed to get exit status");
|
||||
|
||||
if exit_code == 0 {
|
||||
println!("{service} service is active {EMOJI_CHECK}");
|
||||
println!("{EMOJI_CHECK} {service} service is active");
|
||||
} else {
|
||||
println!("{service} service is inactive {EMOJI_CROSS} (exit code: {exit_code})");
|
||||
println!("{EMOJI_CROSS} {service} service is inactive (exit code: {exit_code})");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue