Update dsmon.sh
This commit is contained in:
44
dsmon.sh
44
dsmon.sh
@@ -336,29 +336,33 @@ GETCRONTABS(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
GETCRONTAB(){
|
GETCRONTAB(){
|
||||||
if ! command -v sshpass > /dev/null; then
|
if [ "${1}" != "" ]; then
|
||||||
apt install -y sshpass > /dev/null 2>&1
|
if ! command -v sshpass > /dev/null; then
|
||||||
fi
|
apt install -y sshpass > /dev/null 2>&1
|
||||||
# hostname=$(hostname)
|
fi
|
||||||
|
# hostname=$(hostname)
|
||||||
|
|
||||||
|
if [ "$(CHECK_HOST 10.10.10.50)" != "false" ]; then
|
||||||
|
nmip=10.10.10.50
|
||||||
|
elif [ "$(CHECK_HOST 100.100.55.1)" != "false" ]; then
|
||||||
|
nmip=100.100.55.1
|
||||||
|
else
|
||||||
|
nmip=
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${nmip}" != "" ]; then
|
||||||
|
while read host hostname; do
|
||||||
|
if [ "${host}" != "host" ]; then
|
||||||
|
crontab -l | sshpass -p${1} ssh -o 'StrictHostKeyChecking no' nm_crontab_user@${nmip} "cat > ${DS_CRONTAB_FOLDER}/${host}.crontab"
|
||||||
|
fi
|
||||||
|
done <<< $(MYSQL_PWD="sysmoninsert" mysql -h mysqldb.scity.us -P 3306 -u sysmoninsert -e "SELECT host,hostname FROM servermonitor.hosts WHERE id=${SERVERMON_ID} ORDER BY host ASC")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# [ "${nmip}" != "" ] && crontab -l | sshpass -p${1} ssh -o 'StrictHostKeyChecking no' nm_crontab_user@${nmip} "cat > ${DS_CRONTAB_FOLDER}/${hostname}.crontab"
|
||||||
|
|
||||||
if [ "$(CHECK_HOST 10.10.10.50)" != "false" ]; then
|
|
||||||
nmip=10.10.10.50
|
|
||||||
elif [ "$(CHECK_HOST 100.100.55.1)" != "false" ]; then
|
|
||||||
nmip=100.100.55.1
|
|
||||||
else
|
else
|
||||||
nmip=
|
echo "No user password specified"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${nmip}" != "" ]; then
|
|
||||||
while read host hostname; do
|
|
||||||
if [ "${host}" != "host" ]; then
|
|
||||||
crontab -l | sshpass -p${1} ssh -o 'StrictHostKeyChecking no' nm_crontab_user@${nmip} "cat > ${DS_CRONTAB_FOLDER}/${host}.crontab"
|
|
||||||
fi
|
|
||||||
done <<< $(MYSQL_PWD="sysmoninsert" mysql -h mysqldb.scity.us -P 3306 -u sysmoninsert -e "SELECT host,hostname FROM servermonitor.hosts WHERE id=${SERVERMON_ID} ORDER BY host ASC")
|
|
||||||
fi
|
|
||||||
|
|
||||||
# [ "${nmip}" != "" ] && crontab -l | sshpass -p${1} ssh -o 'StrictHostKeyChecking no' nm_crontab_user@${nmip} "cat > ${DS_CRONTAB_FOLDER}/${hostname}.crontab"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case $action in
|
case $action in
|
||||||
|
|||||||
Reference in New Issue
Block a user