This commit is contained in:
2025-07-05 13:59:11 -05:00
parent 4a5d936eec
commit e525a182e3
2 changed files with 12 additions and 8 deletions

View File

@@ -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 "

View File

@@ -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