This commit is contained in:
2023-07-04 21:31:03 -05:00
parent 2be1fa9bd9
commit 5e35d373e9
3 changed files with 21 additions and 11 deletions

View File

@@ -308,9 +308,13 @@ GETCRONTABS(){
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 WHERE disabled=0 ORDER BY host ASC")
read -p "Enter the password for the 'nm_crontab_user' account on MySQL-Manager: " rtpsswd
echo
if [ "${1}" == "" ]; then
read -p "Enter the password for the 'nm_crontab_user' account on MySQL-Manager: " rtpsswd
echo
else
rtpsswd=${1}
fi
for hostid in "${!host_ip[@]}"; do
checkhost=$(CHECK_HOST ${host_ip[$hostid]})
@@ -343,14 +347,14 @@ GETCRONTAB(){
nmip=
fi
[ "${nmip}" != "" ] && crontab -l | sshpass -p${1} ssh -o 'StrictHostKeyChecking no' nm_crontab_user@${nmip} "cat > /opt/idssys/nodemgmt/crontabs/${hostname}.crontab"
[ "${nmip}" != "" ] && crontab -l | sshpass -p${1} ssh -o 'StrictHostKeyChecking no' nm_crontab_user@${nmip} "cat > ${DS_CRONTAB_FOLDER}/${hostname}.crontab"
}
case $action in
check) CHECK ${2};;
setupssh) SETUPSSH;;
get-crontabs) GETCRONTABS;;
get-crontabs) GETCRONTABS ${2};;
get-crontab) GETCRONTAB ${2};;
run) RUN ${2};;
runcmd) RUNCMD ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11};;