From c578606ca68b043124e37b78010a6eadf42cd4e4 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Mon, 19 Feb 2024 09:27:23 -0600 Subject: [PATCH] update --- defaults.inc | 2 +- dsmon.sh | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/defaults.inc b/defaults.inc index e288824..b55664d 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERS=2.3.25-01262024 +VERS=2.3.26-02192024 DS_FOLDER=/opt/idssys/dsmon DS_CRONTAB_FOLDER=/opt/idssys/nodemgmt/crontabs diff --git a/dsmon.sh b/dsmon.sh index 16f49c4..ad0e25e 100755 --- a/dsmon.sh +++ b/dsmon.sh @@ -330,8 +330,13 @@ SETUPSSH(){ for hostid in "${!host_ip[@]}"; do checkhost=$(CHECK_HOST ${host_ip[$hostid]}) if [ "${checkhost}" != "false" ]; then - echo -e "${idsST[Bold]}${idsCL[LightCyan]} ${host_name[$hostid]} - SSH KEY COPY${idsCL[Default]}${idsST[Reset]}" - ssh-copy-id root@${host_ip[$hostid]} + echo -en "\n${idsCL[LightCyan]}${host_name[$hostid]} - Checking for Public SSH Key ... ${idsCL[Default]}" + if [ "$(ssh -o BatchMode=yes -o ConnectTimeout=3 root@${nip} echo ok 2>&1)" == "ok" ]; then + echo -e "${idsCL[Green]}Already Installed${idsCL[Default]}" + else + echo -e "${idsCL[Yellow]}Copying to Host ...${idsCL[Default]}" + ssh-copy-id root@${host_ip[$hostid]} + fi fi done }