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