diff --git a/defaults.inc b/defaults.inc index 9fb0aac..05d4cb8 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,9 +1,10 @@ #!/usr/bin/env bash -VERS=2.5.6-06142025 +VERS=2.5.7-07052025 DS_FOLDER=/opt/idssys/dsmon DS_CRONTAB_FOLDER=/opt/idssys/nodemgmt/crontabs +DS_COPYCERTS_FOLDER=/opt/idssys/nodemgmt/copycerts.sh noheader=" gettsip-node get-crontabs get-crontab update report updatenodes runcmd runcheck " diff --git a/dsmon.sh b/dsmon.sh index 1afae2c..3e65c30 100755 --- a/dsmon.sh +++ b/dsmon.sh @@ -539,14 +539,14 @@ GETCRONTABS(){ fi for hostid in "${!host_ip[@]}"; do - # echo -e "${idsST[Bold]}${idsCL[LightCyan]} ${host_name[$hostid]} - ${host_ip[$hostid]}${idsCL[Default]}${idsST[Reset]}" - # checkhost=$(CHECK_HOST ${host_ip[$hostid]}) - # if [ "${checkhost}" != "false" ]; then - # echo -e "${idsST[Bold]}${idsCL[LightCyan]} ${host_name[$hostid]} - Gathering Crontabs ... ${idsCL[Default]}${idsST[Reset]}" + echo -e "${idsST[Bold]}${idsCL[LightCyan]} ${host_name[$hostid]} - ${host_ip[$hostid]}${idsCL[Default]}${idsST[Reset]}" + checkhost=$(CHECK_HOST ${host_ip[$hostid]}) + if [ "${checkhost}" != "false" ]; then + echo -e "${idsST[Bold]}${idsCL[LightCyan]} ${host_name[$hostid]} - Gathering Crontabs, and copycerts.sh if it exists ... ${idsCL[Default]}${idsST[Reset]}" ${SSHCMD} root@${host_ip[$hostid]} dsmon get-crontab ${rtpsswd} - # else - # echo -e "${idsST[Bold]}${idsCL[Red]} ${host_name[$hostid]} - Timeout${idsCL[Default]}${idsST[Reset]}" - # fi + else + echo -e "${idsST[Bold]}${idsCL[Red]} ${host_name[$hostid]} - Timeout${idsCL[Default]}${idsST[Reset]}" + fi done echo @@ -566,6 +566,9 @@ GETCRONTAB(){ if [ "${host}" != "host" ] && [ "${host}" != "" ]; then # echo -e "${SERVERMON_ID}) ${host} : ${hostname}\nmysqlip=${mysqlip}\n" crontab -l | sshpass -p${1} ${SSHCMD} -o 'StrictHostKeyChecking no' nm_crontab_user@${nmip} "cat > ${DS_CRONTAB_FOLDER}/${host}.crontab" + if [ -f /opt/copycerts.sh ]; then + cat /opt/copycerts.sh | sshpass -p${1} ${SSHCMD} -o 'StrictHostKeyChecking no' nm_crontab_user@${nmip} "cat > ${DS_COPYCERTS_FOLDER}/${host}_copycerts.sh" + fi fi done <<< $(MYSQL_PWD="sysmoninsert" ${mysqlcmd} ${mysql_conn} -u sysmoninsert -e "SELECT host,hostname FROM servermonitor.hosts WHERE id=${SERVERMON_ID}") fi