Update dsmon.sh
This commit is contained in:
24
dsmon.sh
24
dsmon.sh
@@ -263,19 +263,17 @@ RUNCMD(){
|
||||
declare -A host_ip
|
||||
declare -A host_name
|
||||
|
||||
# while read hostid hostname hostip hostlimits; do
|
||||
# if [ "$hostid" != "id" ]; then
|
||||
# host_ip[${hostid}]=$(echo $hostip | cut -d ";" -f1)
|
||||
# host_name[${hostid}]=$hostname
|
||||
# fi
|
||||
# done <<< $(MYSQL_PWD="sysmoninsert" mysql -h mysqldb.scity.us -P 3306 -u sysmoninsert -e "SELECT id,host,ip,limits FROM servermonitor.hosts")
|
||||
#
|
||||
# for hostid in "${!host_ip[@]}"; do
|
||||
# echo -e "${idsST[Bold]}${idsCL[LightCyan]} ${host_name[$hostid]} - Running command: ${1}${idsCL[Default]}${idsST[Reset]}"
|
||||
# ssh root@${host_ip[$hostid]} "${1}"
|
||||
# done
|
||||
|
||||
echo ${1}
|
||||
while read hostid hostname hostip hostlimits; do
|
||||
if [ "$hostid" != "id" ]; then
|
||||
host_ip[${hostid}]=$(echo $hostip | cut -d ";" -f1)
|
||||
host_name[${hostid}]=$hostname
|
||||
fi
|
||||
done <<< $(MYSQL_PWD="sysmoninsert" mysql -h mysqldb.scity.us -P 3306 -u sysmoninsert -e "SELECT id,host,ip,limits FROM servermonitor.hosts")
|
||||
|
||||
for hostid in "${!host_ip[@]}"; do
|
||||
echo -e "${idsST[Bold]}${idsCL[LightCyan]} ${host_name[$hostid]} - Running command: ${1}${idsCL[Default]}${idsST[Reset]}"
|
||||
ssh root@${host_ip[$hostid]} "${1}"
|
||||
done
|
||||
}
|
||||
|
||||
case $action in
|
||||
|
||||
Reference in New Issue
Block a user