Update dsmon.sh

This commit is contained in:
2024-01-06 18:05:34 -06:00
parent 47f8bd59b7
commit 3a37c5e96a

View File

@@ -396,13 +396,13 @@ GETCRONTABS(){
for hostid in "${!host_ip[@]}"; do for hostid in "${!host_ip[@]}"; do
# echo -e "${idsST[Bold]}${idsCL[LightCyan]} ${host_name[$hostid]} - ${host_ip[$hostid]}${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]}) checkhost=$(CHECK_HOST ${host_ip[$hostid]})
# if [ "${checkhost}" != "false" ]; then if [ "${checkhost}" != "false" ]; then
echo -e "${idsST[Bold]}${idsCL[LightCyan]} ${host_name[$hostid]} - Gathering Crontabs ... ${idsCL[Default]}${idsST[Reset]}" echo -en "${idsST[Bold]}${idsCL[LightCyan]} ${host_name[$hostid]} - Gathering Crontabs ... ${idsCL[Default]}${idsST[Reset]}"
ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 -t root@${host_ip[$hostid]} dsmon get-crontab ${rtpsswd} & ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 -t root@${host_ip[$hostid]} dsmon get-crontab ${rtpsswd} &
# else else
# echo -e "${idsST[Bold]}${idsCL[Red]} ${host_name[$hostid]} - Timeout${idsCL[Default]}${idsST[Reset]}" echo -e "${idsST[Bold]}${idsCL[Red]} ${host_name[$hostid]} - Timeout${idsCL[Default]}${idsST[Reset]}"
# fi fi
done done
echo echo
@@ -422,15 +422,15 @@ GETCRONTAB(){
while read host hostname; do while read host hostname; do
if [ "${host}" != "host" ]; then if [ "${host}" != "host" ]; then
crontab -l | sshpass -p${1} ssh -o 'StrictHostKeyChecking no' nm_crontab_user@${nmip} "cat > ${DS_CRONTAB_FOLDER}/${host}.crontab" crontab -l | sshpass -p${1} ssh -o 'StrictHostKeyChecking no' nm_crontab_user@${nmip} "cat > ${DS_CRONTAB_FOLDER}/${host}.crontab"
# echo -e "${idsCL[Green]} done${idsCL[Default]}" echo -e "${idsCL[Green]} done${idsCL[Default]}"
fi fi
done <<< $(MYSQL_PWD="sysmoninsert" mysql -h ${mysqlip} -u sysmoninsert -e "SELECT host,hostname FROM servermonitor.hosts WHERE id=${SERVERMON_ID}") done <<< $(MYSQL_PWD="sysmoninsert" mysql -h ${mysqlip} -u sysmoninsert -e "SELECT host,hostname FROM servermonitor.hosts WHERE id=${SERVERMON_ID}")
fi fi
# [ "${nmip}" != "" ] && crontab -l | sshpass -p${1} ssh -o 'StrictHostKeyChecking no' nm_crontab_user@${nmip} "cat > ${DS_CRONTAB_FOLDER}/${hostname}.crontab" # [ "${nmip}" != "" ] && crontab -l | sshpass -p${1} ssh -o 'StrictHostKeyChecking no' nm_crontab_user@${nmip} "cat > ${DS_CRONTAB_FOLDER}/${hostname}.crontab"
# else else
# echo "No user password specified" echo "No user password specified"
fi fi
} }
FIXCRONTAB(){ FIXCRONTAB(){