update
This commit is contained in:
@@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
VERS=2.2.10-07042023
|
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(){
|
SENDNOTICE(){
|
||||||
[ "${PUSHOVER_APP_TOKEN}" != "" ] && PUSH_TO_MOBILE "${2}
|
[ "${PUSHOVER_APP_TOKEN}" != "" ] && PUSH_TO_MOBILE "${2}
|
||||||
|
|
||||||
|
|||||||
8
dsmon.sh
8
dsmon.sh
@@ -309,8 +309,12 @@ GETCRONTABS(){
|
|||||||
fi
|
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")
|
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")
|
||||||
|
|
||||||
|
if [ "${1}" == "" ]; then
|
||||||
read -p "Enter the password for the 'nm_crontab_user' account on MySQL-Manager: " rtpsswd
|
read -p "Enter the password for the 'nm_crontab_user' account on MySQL-Manager: " rtpsswd
|
||||||
echo
|
echo
|
||||||
|
else
|
||||||
|
rtpsswd=${1}
|
||||||
|
fi
|
||||||
|
|
||||||
for hostid in "${!host_ip[@]}"; do
|
for hostid in "${!host_ip[@]}"; do
|
||||||
checkhost=$(CHECK_HOST ${host_ip[$hostid]})
|
checkhost=$(CHECK_HOST ${host_ip[$hostid]})
|
||||||
@@ -343,14 +347,14 @@ GETCRONTAB(){
|
|||||||
nmip=
|
nmip=
|
||||||
fi
|
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
|
case $action in
|
||||||
check) CHECK ${2};;
|
check) CHECK ${2};;
|
||||||
setupssh) SETUPSSH;;
|
setupssh) SETUPSSH;;
|
||||||
get-crontabs) GETCRONTABS;;
|
get-crontabs) GETCRONTABS ${2};;
|
||||||
get-crontab) GETCRONTAB ${2};;
|
get-crontab) GETCRONTAB ${2};;
|
||||||
run) RUN ${2};;
|
run) RUN ${2};;
|
||||||
runcmd) RUNCMD ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11};;
|
runcmd) RUNCMD ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11};;
|
||||||
|
|||||||
12
run.sh
12
run.sh
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
source /opt/idssys/defaults/colors.inc
|
source /opt/idssys/defaults/colors.inc
|
||||||
source /opt/idssys/defaults/default.inc
|
source /opt/idssys/defaults/default.inc
|
||||||
source /opt/idssys/dsmon/config.settings.inc
|
source ${DS_FOLDER}/config.settings.inc
|
||||||
source /opt/idssys/dsmon/defaults.inc
|
source ${DS_FOLDER}/defaults.inc
|
||||||
|
|
||||||
|
|
||||||
if [ "${1}" == "update" ]; then
|
if [ "${1}" == "update" ]; then
|
||||||
@@ -31,7 +31,7 @@ if [ "${1}" == "update" ]; then
|
|||||||
git pull >/dev/null 2>&1
|
git pull >/dev/null 2>&1
|
||||||
git submodule update --remote >/dev/null 2>&1
|
git submodule update --remote >/dev/null 2>&1
|
||||||
fi
|
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 [ "`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
|
if [ "${2}" != "q" ]; then
|
||||||
echo -en "\e[1A";
|
echo -en "\e[1A";
|
||||||
@@ -44,8 +44,8 @@ if [ "${1}" == "update" ]; then
|
|||||||
git prune >/dev/null 2>&1
|
git prune >/dev/null 2>&1
|
||||||
git pull >/dev/null 2>&1
|
git pull >/dev/null 2>&1
|
||||||
git submodule update --remote >/dev/null 2>&1
|
git submodule update --remote >/dev/null 2>&1
|
||||||
/bin/chmod +x /opt/idssys/dsmon/dsmon.sh 2>&1
|
/bin/chmod +x ${DS_FOLDER}/dsmon.sh 2>&1
|
||||||
source /opt/idssys/dsmon/defaults.inc
|
source ${DS_FOLDER}/defaults.inc
|
||||||
if [ "${2}" != "q" ]; then
|
if [ "${2}" != "q" ]; then
|
||||||
echo -en "\e[1A";
|
echo -en "\e[1A";
|
||||||
echo -e "\e[0K\r ${idsCL[Green]}Updated to v${VERS}${idsCL[Default]}"
|
echo -e "\e[0K\r ${idsCL[Green]}Updated to v${VERS}${idsCL[Default]}"
|
||||||
@@ -59,7 +59,7 @@ if [ "${1}" == "update" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
/opt/idssys/dsmon/dsmon.sh "$1" "$2" $3 $4
|
${DS_FOLDER}/dsmon.sh "$1" "$2" $3 $4
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user