update
This commit is contained in:
16
defaults.inc
16
defaults.inc
@@ -10,11 +10,11 @@ NODE_HOSTS=(${NODE_HOSTS})
|
||||
NODE_SERVICES=(${NODE_SERVICES})
|
||||
unset IFS
|
||||
|
||||
declare -A idsNMservices
|
||||
idsNMservices[mysql]='MySQL'
|
||||
idsNMservices[nginx]='NGINX'
|
||||
idsNMservices[gogs]='Gogs'
|
||||
idsNMservices[gitea]='Gitea'
|
||||
idsNMservices[haproxy]='HAProxy'
|
||||
idsNMservices[keepalived]='Keepalived'
|
||||
idsNMservices[maxscale]='MaxScale'
|
||||
declare -A NM_SERVICES
|
||||
NM_SERVICES['mysql']='MySQL'
|
||||
NM_SERVICES['nginx']='NGINX'
|
||||
NM_SERVICES['gogs']='Gogs'
|
||||
NM_SERVICES['gitea']='Gitea'
|
||||
NM_SERVICES['haproxy']='HAProxy'
|
||||
NM_SERVICES['keepalived']='Keepalived'
|
||||
NM_SERVICES['maxscale']='MaxScale'
|
||||
|
||||
@@ -18,14 +18,14 @@ case "$1" in
|
||||
echo -e "${idsCL[Red]}(${3}) is not an allowed service action.${idsCL[Default]}"
|
||||
exit 1
|
||||
fi
|
||||
if [ "${idsNMservices[${2}]}" = "" ]; then idsNMservices[${2}]="${srvc}"; fi
|
||||
if [ "${NM_SERVICES[${2}]}" = "" ]; then NM_SERVICES[${2}]="${srvc}"; fi
|
||||
if [ "$3" = "stop" ]; then ADISP='Stopp';
|
||||
elif [ "$3" = "enable" ]; then ADISP='Enabl';
|
||||
elif [ "$3" = "disable" ]; then ADISP='Disabl';
|
||||
else ADISP="$(tr '[:lower:]' '[:upper:]' <<< ${3:0:1})${3:1}"; fi
|
||||
if [ "$3" = "start" ] && [ "$2" = "haproxy" ]; then TACT='restart'; else TACT="${3}"; fi
|
||||
|
||||
echo -e "${idsCL[LightGreen]}[[${idsNMservices[${srvc}]} ${ADISP}ing]]${idsCL[Default]}"
|
||||
echo -e "${idsCL[LightGreen]}[[${NM_SERVICES[${srvc}]} ${ADISP}ing]]${idsCL[Default]}"
|
||||
echo -e "${idsCL[LightGreen]}-------------------------------------------${idsCL[Default]}"
|
||||
|
||||
nid=1
|
||||
@@ -50,7 +50,7 @@ case "$1" in
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[Green]}${idsNMservices[${srvc}]} has been ${ADISP}ed${idsCL[Default]}"
|
||||
echo -e "${idsCL[Green]}${NM_SERVICES[${srvc}]} has been ${ADISP}ed${idsCL[Default]}"
|
||||
echo ""
|
||||
exit 0
|
||||
;;
|
||||
@@ -110,8 +110,8 @@ case "$1" in
|
||||
|
||||
for srvc in "${NODE_SERVICES[@]}"
|
||||
do
|
||||
if [ "${idsNMservices[${srvc}]}" = "" ]; then idsNMservices[${srvc}]="${srvc}"; fi
|
||||
echo -en "${idsNMservices[${srvc}]} "
|
||||
if [ "${NM_SERVICES[${srvc}]}" = "" ]; then NM_SERVICES[${srvc}]="${srvc}"; fi
|
||||
echo -en "${NM_SERVICES[${srvc}]} "
|
||||
if [ $(${NCMD} pgrep ${srvc} | wc -l) -gt "0" ]; then
|
||||
echo -e "${idsCL[Green]}Running${idsCL[Default]}"
|
||||
else echo -e "${idsCL[Red]}Not Running${idsCL[Default]}"
|
||||
@@ -133,10 +133,10 @@ case "$1" in
|
||||
fi
|
||||
for srvc in "${NODE_SERVICES[@]}"
|
||||
do
|
||||
if [ "${idsNMservices[${srvc}]}" = "" ]; then idsNMservices[${srvc}]="${srvc}"; fi
|
||||
if [ "${NM_SERVICES[${srvc}]}" = "" ]; then NM_SERVICES[${srvc}]="${srvc}"; fi
|
||||
if [ "${STATUS_CHECK_EMAIL}" != "" ]; then
|
||||
if [ $(${NCMD} pgrep ${srvc} | wc -l) -lt "1" ]; then
|
||||
echo "${idsNMservices[${srvc}]} is down" | mail -s "iDS-Node${nid}-${nip}" ${STATUS_CHECK_EMAIL}
|
||||
echo "${NM_SERVICES[${srvc}]} is down" | mail -s "iDS-Node${nid}-${nip}" ${STATUS_CHECK_EMAIL}
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
4
run.sh
4
run.sh
@@ -14,8 +14,8 @@ if [ "$1" != "service" ] && [ "$1" != "status" ] && [ "$1" != "status-check" ];
|
||||
echo -e "Node hostname: ${NODE_HOSTNAME}"
|
||||
for srvc in "${NODE_SERVICES[@]}"
|
||||
do
|
||||
if [ "${idsNMservices[${srvc}]}" = "" ]; then idsNMservices[${srvc}]="${srvc}"; fi
|
||||
echo -en "${idsNMservices[${srvc}]} "
|
||||
if [ "${NM_SERVICES[${srvc}]}" = "" ]; then NM_SERVICES[${srvc}]="${srvc}"; fi
|
||||
echo -en "${NM_SERVICES[${srvc}]} "
|
||||
if [ $(pgrep ${srvc} | wc -l) -gt "0" ]; then
|
||||
echo -e "${idsCL[Green]}Running${idsCL[Default]}"
|
||||
else echo -e "${idsCL[Red]}Not Running${idsCL[Default]}"
|
||||
|
||||
Reference in New Issue
Block a user