Update dsmon.sh

This commit is contained in:
2025-07-05 14:17:06 -05:00
parent bb28765ef1
commit 716a43f587

View File

@@ -542,7 +542,8 @@ GETCRONTABS(){
# 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
${SSHCMD} root@${host_ip[$hostid]} dsmon get-crontab ${rtpsswd} & > /dev/null 2>&1
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
@@ -563,11 +564,10 @@ GETCRONTAB(){
if [ "${nmip}" != "" ]; then
while read host hostname; do
if [ "${host}" != "host" ] && [ "${host}" != "" ]; then
echo -e "${idsST[Bold]}${idsCL[LightCyan]} ${host} - Gathering Crontabs, and copycerts.sh if it exists ... ${idsCL[Default]}${idsST[Reset]}"
# 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"
crontab -l | sshpass -p${1} ${SSHCMD} -o 'StrictHostKeyChecking no' nm_crontab_user@${nmip} "cat > ${DS_CRONTAB_FOLDER}/${host}.crontab" > /dev/null 2>&1
if [ -f /opt/copycerts.sh ]; then
sshpass -p${1} scp /opt/copycerts.sh nm_crontab_user@${nmip}:${DS_COPYCERTS_FOLDER}/${host}_copycerts.sh
sshpass -p${1} scp /opt/copycerts.sh nm_crontab_user@${nmip}:${DS_COPYCERTS_FOLDER}/${host}_copycerts.sh > /dev/null 2>&1
fi
fi
done <<< $(MYSQL_PWD="sysmoninsert" ${mysqlcmd} ${mysql_conn} -u sysmoninsert -e "SELECT host,hostname FROM servermonitor.hosts WHERE id=${SERVERMON_ID}")
@@ -575,8 +575,8 @@ GETCRONTAB(){
# [ "${nmip}" != "" ] && crontab -l | sshpass -p${1} ssh -o 'StrictHostKeyChecking no' nm_crontab_user@${nmip} "cat > ${DS_CRONTAB_FOLDER}/${hostname}.crontab"
else
echo "No user password specified"
# else
# echo "No user password specified"
fi
}
FIXCRONTAB(){