diff --git a/dsmon.sh b/dsmon.sh index 708e396..362ff04 100755 --- a/dsmon.sh +++ b/dsmon.sh @@ -336,13 +336,21 @@ RUNCMD(){ echo -e "\n${idsCL[White]}The following command will be run on all nodes:" echo -e "${idsST[Bold]}'${idsCL[LightCyan]}$(echo "${1} ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20}" | awk '{$1=$1};1')${idsCL[White]}'${idsCL[Default]}${idsST[Reset]}\n" ncount=0 + + while read hostid hostname hostip hostlimits; do if [ "${hostname}" != "host" ]; then - RUNCMD_SUB $(echo ${hostip} | cut -d ";" -f1) ${hostname} ${1} ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20} ###& - ((ncount++)) + ssh -tq -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${ip} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20} ${21} ${22} fi done <<< $(MYSQL_PWD="sysmoninsert" mysql -h ${mysqlip} -P 3307 -u sysmoninsert -e "SELECT id,host,ip,limits FROM servermonitor.hosts WHERE disabled=0 ORDER BY host ASC") - + + # while read hostid hostname hostip hostlimits; do + # if [ "${hostname}" != "host" ]; then + # RUNCMD_SUB $(echo ${hostip} | cut -d ";" -f1) ${hostname} ${1} ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20} ###& + # ((ncount++)) + # fi + # done <<< $(MYSQL_PWD="sysmoninsert" mysql -h ${mysqlip} -P 3307 -u sysmoninsert -e "SELECT id,host,ip,limits FROM servermonitor.hosts WHERE disabled=0 ORDER BY host ASC") + # # nc_count=0; lcount=0; completed=false # until [ "${completed}" == "true" ]; do # for nodecmd in /tmp/.dsmon.runcmd.*.done; do