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

@@ -2,6 +2,12 @@
VERS=2.2.10-07042023
DS_FOLDER=/opt/idssys/dsmon
DS_CRONTAB_FOLDER=/opt/idssys/nodemgmt/crontabs
[ ! -d ${DS_CRONTAB_FOLDER} ] && mkdir ${DS_CRONTAB_FOLDER} && chmod -Rf 0777 ${DS_CRONTAB_FOLDER}
SENDNOTICE(){
[ "${PUSHOVER_APP_TOKEN}" != "" ] && PUSH_TO_MOBILE "${2}

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};;

12
run.sh
View File

@@ -2,8 +2,8 @@
source /opt/idssys/defaults/colors.inc
source /opt/idssys/defaults/default.inc
source /opt/idssys/dsmon/config.settings.inc
source /opt/idssys/dsmon/defaults.inc
source ${DS_FOLDER}/config.settings.inc
source ${DS_FOLDER}/defaults.inc
if [ "${1}" == "update" ]; then
@@ -31,7 +31,7 @@ if [ "${1}" == "update" ]; then
git pull >/dev/null 2>&1
git submodule update --remote >/dev/null 2>&1
fi
cd /opt/idssys/dsmon
cd ${DS_FOLDER}
if [ "`git log --pretty=%H ...refs/heads/master^ | head -n 1`" != "`git ls-remote origin -h refs/heads/master |cut -f1`" ]; then
if [ "${2}" != "q" ]; then
echo -en "\e[1A";
@@ -44,8 +44,8 @@ if [ "${1}" == "update" ]; then
git prune >/dev/null 2>&1
git pull >/dev/null 2>&1
git submodule update --remote >/dev/null 2>&1
/bin/chmod +x /opt/idssys/dsmon/dsmon.sh 2>&1
source /opt/idssys/dsmon/defaults.inc
/bin/chmod +x ${DS_FOLDER}/dsmon.sh 2>&1
source ${DS_FOLDER}/defaults.inc
if [ "${2}" != "q" ]; then
echo -en "\e[1A";
echo -e "\e[0K\r ${idsCL[Green]}Updated to v${VERS}${idsCL[Default]}"
@@ -59,7 +59,7 @@ if [ "${1}" == "update" ]; then
fi
fi
/opt/idssys/dsmon/dsmon.sh "$1" "$2" $3 $4
${DS_FOLDER}/dsmon.sh "$1" "$2" $3 $4
exit 0