Update nodemgmt-scripts.sh

This commit is contained in:
2019-03-27 01:00:13 -05:00
parent 2f2b60cc94
commit 1d0cd9a797

View File

@@ -163,9 +163,27 @@ STATUS(){
if [ "$(${NCMD} systemctl is-active ${srvc})" != "active" ]; then
if [ ! -f ${FOLDER}/${nip}-${srvc}.down ]; then
if [ "${srvc}" == "gitea" ]; then
echo
SERVICE gitea stop q
SET-PERMISSIONS gitea q
SERVICE gitea start q
if [ "${ST_ACTION}" != "check" ]; then
if [ "$(${NCMD} systemctl is-active ${srvc})" != "active" ]; then
echo -e "${idsCL[Red]}Not Running - could not fix${idsCL[Default]}"
if [ "${STATUS_CHECK_EMAIL}" != "" ]; then echo "${NM_SERVICES[${srvc}]} is down. Could not fix." | mail -s "${NM_NODETYPES[$NTYPE]}-Node${nid}-${nip}" ${STATUS_CHECK_EMAIL}; fi
touch ${FOLDER}/${nip}-${srvc}.down
else
echo -e "${idsCL[Red]}Running - FIXED${idsCL[Default]}"
if [ -f ${FOLDER}/${nip}-${srvc}.down ]; then
if [ -f ${FOLDER}/${nip}-${srvc}.errtime ]; then
toterrtime=`date +%s`-$(stat -c %Y ${FOLDER}/${nip}-${srvc}.errtime)
else
toterrtime=`date +%s`-$(stat -c %Y ${FOLDER}/${nip}-${srvc}.down)
fi
if [ "${STATUS_CHECK_EMAIL}" != "" ]; then echo "${NM_SERVICES[${srvc}]} is back UP! (!!FIXED!!) It was down for $(SHOW_TIME ${toterrtime})" | mail -s "${NM_NODETYPES[$NTYPE]}-Node${nid}-${nip}" ${STATUS_CHECK_EMAIL}; fi
rm -f ${FOLDER}/${nip}-${srvc}.down
rm -f ${FOLDER}/${nip}-${srvc}.errtime
fi
fi
else
if [ "${ST_ACTION}" != "check" ]; then
@@ -1041,12 +1059,16 @@ SET-PERMISSIONS(){
else
NCMD="ssh root@${nip}"
fi
echo -en "${idsCL[Yellow]}Resetting folder permissions for Gitea on Webserver-Node${nid} (${nip})... ${idsCL[Default]}"
if [ "${2}" != "q" ]; then
echo -en "${idsCL[Yellow]}Resetting folder permissions for Gitea on Webserver-Node${nid} (${nip})... ${idsCL[Default]}"
fi
${NCMD} chown -R git:git /var/lib/gitea
${NCMD} chmod -R 750 /var/lib/gitea
${NCMD} chown -R git:git /home/git
${NCMD} chmod -R 750 /home/git
echo -e "${idsCL[Green]}Complete${idsCL[Default]}"
if [ "${2}" != "q" ]; then
echo -e "${idsCL[Green]}Complete${idsCL[Default]}"
fi
done
else
DIVIDER