diff --git a/dsmon.sh b/dsmon.sh index d7c3d0c..4790170 100755 --- a/dsmon.sh +++ b/dsmon.sh @@ -315,9 +315,6 @@ GETCRONTABS(){ for hostid in "${!host_ip[@]}"; do checkhost=$(CHECK_HOST ${host_ip[$hostid]}) if [ "${checkhost}" != "false" ]; then - if ! ssh -tq root@${host_ip[$hostid]} command -v sshpass > /dev/null; then - ssh -tq root@${host_ip[$hostid]} apt install -yq sshpass > /dev/null 2>&1 - fi echo -e "${idsST[Bold]}${idsCL[LightCyan]} ${host_name[$hostid]} - Gathering Crontabs${idsCL[Default]}${idsST[Reset]}" ssh -tq root@${host_ip[$hostid]} dsmon get-crontab ${rtpsswd} else @@ -333,6 +330,9 @@ GETCRONTABS(){ } GETCRONTAB(){ + if ! command -v sshpass > /dev/null; then + apt install -yq sshpass > /dev/null 2>&1 + fi hostname=$(hostname) crontab -l | sshpass -p${1} ssh -o 'StrictHostKeyChecking no' nm_crontab_user@10.10.10.50 "cat > /opt/idssys/nodemgmt/crontabs/${hostname}.crontab"