Update status.inc
This commit is contained in:
@@ -4,7 +4,7 @@ STATUS(){
|
||||
|
||||
PRI_CW=40;
|
||||
ST_ACTION=${1}
|
||||
[ "${ST_ACTION}" = "sync" ] && ST_ACTION=repl
|
||||
[ "${ST_ACTION}" == "sync" ] && ST_ACTION=repl
|
||||
declare -i cw; declare -i spc1; declare -i c
|
||||
|
||||
ntypesel=""
|
||||
@@ -21,9 +21,9 @@ STATUS(){
|
||||
## REPLICATION CHECK SETUP
|
||||
############################
|
||||
|
||||
[ ! -f ${NM_TMPFOLDER}/.replcheck ] || [ $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/.replcheck)) -ge 300 ] && REPLRUN=1 || REPLRUN=0
|
||||
([ ! -f ${NM_TMPFOLDER}/.replcheck ] || [ $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/.replcheck)) -ge 300 ]) && REPLRUN=1 || REPLRUN=0
|
||||
# if [ "${ST_ACTION}" == "report" ] || [ "${ST_ACTION}" == "repl" ] || [ "${ST_ACTION}" == "check" ] || [ "${ST_ACTION}" == "" ]; then
|
||||
if [ "${ST_ACTION}" == "repl" ] || [ "${ST_ACTION}" == "" ] || [ ${REPLRUN} -eq 1 ]; then
|
||||
if [ "${ST_ACTION}" == "repl" ] || [ "${ST_ACTION}" == "" ] || ([ "${ST_ACTION}" == "report" ] && [ ${REPLRUN} -eq 1 ]); then
|
||||
if [ "${ST_ACTION}" != "check" ]; then
|
||||
echo -en "${idsCL[LightCyan]}Setting up replication checks ... ${idsCL[Default]}"
|
||||
fi
|
||||
@@ -39,7 +39,7 @@ STATUS(){
|
||||
########################
|
||||
## LOCALHOST CHECK
|
||||
########################
|
||||
if [ "${ST_ACTION}" = "" ] || [ "${ST_ACTION}" = "report" ] || [ "${ST_ACTION}" = "services" ] || [ "${ST_ACTION}" = "dockers" ] || [ "${ST_ACTION}" = "check" ] || [ "${ST_ACTION}" == "all" ]; then
|
||||
if [ "${ST_ACTION}" == "" ] || [ "${ST_ACTION}" == "report" ] || [ "${ST_ACTION}" == "services" ] || [ "${ST_ACTION}" == "dockers" ] || [ "${ST_ACTION}" == "check" ] || [ "${ST_ACTION}" == "all" ]; then
|
||||
cpu_usage=$(awk '{u=$2+$4; t=$2+$4+$5; if (NR==1){u1=u; t1=t;} else print ($2+$4-u1) * 100 / (t-t1) "%"; }' <(grep 'cpu ' /proc/stat) <(sleep 1;grep 'cpu ' /proc/stat) | sed -e 's/%//g')
|
||||
|
||||
if [ ! -z ${LOCAL_SERVICES+x} ] && [ "${ST_ACTION}" != "dockers" ]; then
|
||||
@@ -140,7 +140,7 @@ STATUS(){
|
||||
########################
|
||||
|
||||
# if [ "${ST_ACTION}" == "report" ] || [ "${ST_ACTION}" == "repl" ] || [ "${ST_ACTION}" == "check" ] || [ "${ST_ACTION}" == "" ]; then
|
||||
if [ "${ST_ACTION}" == "repl" ] || [ "${ST_ACTION}" == "" ] || [ ${REPLRUN} -eq 1 ]; then
|
||||
if [ "${ST_ACTION}" == "repl" ] || [ "${ST_ACTION}" == "" ] || ([ "${ST_ACTION}" == "report" ] && [ ${REPLRUN} -eq 1 ]); then
|
||||
if [ "${ST_ACTION}" != "check" ]; then
|
||||
echo -e "${idsST[Bold]}"; DIVIDER
|
||||
echo -e "${idsCL[Yellow]} Replication Status Between the Primary and Secondary Nodes${idsCL[Default]}"
|
||||
@@ -254,7 +254,7 @@ It was down for $(SHOW_TIME $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${
|
||||
var=${NTYPE}_REPL_CHECK[@]
|
||||
if [ ! -z ${!var+x} ]; then
|
||||
for rcheck in "${!var}"; do
|
||||
if [ "${PH_CMD}" = "" ]; then
|
||||
if [ "${PH_CMD}" == "" ]; then
|
||||
rm -f ${NM_FOLDER}/test.${STATUS_START//-/}.repl &
|
||||
rm -f ${NM_REPL_CHECK_LOC[${rcheck}]}/test.${STATUS_START//-/}.repl &
|
||||
else
|
||||
@@ -273,8 +273,8 @@ It was down for $(SHOW_TIME $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${
|
||||
########################
|
||||
## FREE SPACE CHECK
|
||||
########################
|
||||
#if [ "${ST_ACTION}" = "" ] || [ "${ST_ACTION}" = "report" ] || [ "${ST_ACTION}" = "freespace" ]; then
|
||||
if [ "${ST_ACTION}" = "freespace" ]; then
|
||||
#if [ "${ST_ACTION}" == "" ] || [ "${ST_ACTION}" == "report" ] || [ "${ST_ACTION}" == "freespace" ]; then
|
||||
if [ "${ST_ACTION}" == "freespace" ]; then
|
||||
for NTYPE in "${ntypesel[@]}"; do
|
||||
if [ "${ST_ACTION}" != "check" ]; then
|
||||
echo -e "${idsST[Bold]}"; DIVIDER
|
||||
@@ -384,7 +384,7 @@ It was down for $(SHOW_TIME $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${
|
||||
########################
|
||||
if [ "${ST_ACTION}" != "check" ]; then
|
||||
echo
|
||||
if [ -z ${ACTION} ] || [ "${ACTION}" = "gui" ]; then
|
||||
if [ -z ${ACTION} ] || [ "${ACTION}" == "gui" ]; then
|
||||
DIVIDER true
|
||||
ENTER2CONTINUE
|
||||
fi
|
||||
@@ -512,7 +512,7 @@ STATUS_NODE(){
|
||||
srvctest=${srvctst[$sr]}
|
||||
if [ "${srvctest}" != "active" ] && [ "${srvc}" == "mysql" ]; then
|
||||
[ "$(${NCMD} systemctl is-active mariadb)" == "active" ] && mysqlgo=true || mysqlgo=false
|
||||
elif [ "${srvctest}" != "active" ] && [ "${srvc}" = "mariadb" ]; then
|
||||
elif [ "${srvctest}" != "active" ] && [ "${srvc}" == "mariadb" ]; then
|
||||
[ "$(${NCMD} systemctl is-active mysql)" == "active" ] && mysqlgo=true || mysqlgo=false
|
||||
elif [ "${srvctest}" == "active" ] && ([ "${srvc}" == "mysql" ] || [ "${srvc}" == "mariadb" ]); then
|
||||
mysqlgo=true
|
||||
@@ -559,7 +559,7 @@ STATUS_NODE(){
|
||||
rm -f ${NM_TMPFOLDER}/${nip}~${srvc}.* &
|
||||
fi
|
||||
fi
|
||||
[ "${mysqlgo}" = "true" ] && unset mysqlgo
|
||||
[ "${mysqlgo}" == "true" ] && unset mysqlgo
|
||||
[ "${SSCHK}" == "primary" ] && echo -e "${idsCL[LightCyan]} - Primary Node${idsCL[Default]}" || echo -e "${idsCL[Default]}"
|
||||
|
||||
elif [ "${srvc}" == "keepalived" ] && ([ "${nip}" == "10.2.1.2" ] || [ "${nip}" == "10.2.1.51" ]); then
|
||||
|
||||
Reference in New Issue
Block a user