Update services.inc

This commit is contained in:
2023-11-06 07:50:27 -06:00
parent 68db2f480b
commit b62ab61b10

View File

@@ -324,25 +324,37 @@ SERVICE(){
fi
checkhost=$(CHECK_HOST ${nip})
if [ "${checkhost}" != "false" ]; then
[ "${1}" = "pdnsadmin" ] && srva="pdnsadmin.socket pdnsadmin.service" || srva=${1}
if [ "${2}" != "status" ]; then
$NCMD systemctl ${2} ${srva} >/dev/null 2>&1
if [ "${1}"= = "offsite-power-check" ]; then
if [ "${3}" != "q" ] && [ "${2}" != "status" ]; then
if [ "$(ssh root@${nip} ps -U root | grep "offsite-power-check.sh start" | grep -v "grep" | awk '{print $1}')" != "" ]; then
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
else
echo -e "${idsCL[Red]}Not Running${idsCL[Default]}"
fi
fi
else
echo
$NCMD systemctl ${2} ${srva}
echo
fi
if [ "${3}" != "q" ] && [ "${2}" != "status" ]; then
if [[ "enable,disable" = *"${2}"* ]] || [ "${1}" = "daemon-reload" ]; then
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
elif [ "$(${NCMD} systemctl is-active ${1})" = "active" ]; then
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
elif [ "$2" = "stop" ]; then
echo -e "${idsCL[Red]}STOPPED${idsCL[Default]}"
[ "${1}" = "pdnsadmin" ] && srva="pdnsadmin.socket pdnsadmin.service" || srva=${1}
if [ "${2}" != "status" ]; then
$NCMD systemctl ${2} ${srva} >/dev/null 2>&1
else
echo -e "${idsCL[Red]}ERROR${idsCL[Default]}"
echo
$NCMD systemctl ${2} ${srva}
echo
fi
if [ "${3}" != "q" ] && [ "${2}" != "status" ]; then
if [[ "enable,disable" = *"${2}"* ]] || [ "${1}" = "daemon-reload" ]; then
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
elif [ "$(${NCMD} systemctl is-active ${1})" = "active" ]; then
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
elif [ "$2" = "stop" ]; then
echo -e "${idsCL[Red]}STOPPED${idsCL[Default]}"
else
echo -e "${idsCL[Red]}ERROR${idsCL[Default]}"
fi
fi
fi
elif [ "${3}" != "q" ]; then
echo -e "${idsCL[Red]}Node is Down${idsCL[Default]}"
fi