Update nodemgmt-scripts.sh

This commit is contained in:
2019-01-27 22:58:49 -06:00
parent 4666d9fd31
commit 86d0094a3f

View File

@@ -4,6 +4,7 @@
action="$1"
VERS='1.01272019'
CERT_DAEMON='/usr/bin/certbot'
SCRIUPT=
source /opt/idssys/nodemgmt/settings.conf
source /opt/idssys/defaults/colors.inc
@@ -19,19 +20,19 @@ unset IFS
case "$1" in
service)
if [ "$2" = "nginx" ]; then SER='NGINX'
if [ "$2" = "nginx" ]; then SER='NGINX'
elif [ "$2" = "haproxy" ]; then SER='HAProxy'
elif [ "$2" = "gogs" ]; then SER='Gogs'
fi
if [ "$3" = "stop" ]; then ADISP='Stopp'; else ADISP="$(tr '[:lower:]' '[:upper:]' <<< ${3:0:1})${3:1}"; fi
STA="$(tr '[:lower:]' '[:upper:]' <<< ${3:0:1})${3:1}"
echo -e "${idsCL[LightGreen]}[[${SER} ${STA}ing]]${idsCL[Default]}"
echo -e "${idsCL[LightGreen]}[[${SER} ${ADSIP}ing]]${idsCL[Default]}"
echo -e "${idsCL[LightGreen]}-------------------------------------------${idsCL[Default]}"
nid=1
for nip in "${NODE_HOSTS[@]}"
do
echo -en "${STA}ing Node ${nid} ($nip)...${idsCL[Default]}"
echo -en "${ADISP}ing Node ${nid} ($nip)...${idsCL[Default]}"
ssh root@${nip} systemctl $3 $2
if [[ $(ssh root@${nip} ps -ef | grep -c ${2}) -ne 1 ]]; then
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
@@ -41,7 +42,7 @@ case "$1" in
done
echo ""
echo -e "${idsCL[Green]}${SER} has been ${STA}ed${idsCL[Default]}"
echo -e "${idsCL[Green]}${SER} has been ${ADISP}ed${idsCL[Default]}"
echo ""
exit 0
;;
@@ -49,9 +50,9 @@ case "$1" in
newcert)
"$0" service haproxy stop
echo -e "${idsCL[LightGreen]}Requesting Certificate for '${idsCL[Yellow]}$2$${idsCL[LightGreen]}'...${idsCL[Default]}"
echo -e "${idsCL[LightGreen]}Requesting Certificate for '${idsCL[Yellow]}${2}${idsCL[LightGreen]}'...${idsCL[Default]}"
# $DAEMON certonly --standalone -d $2
$DAEMON certonly --webroot -w /var/www/html -d $2
$CERT_DAEMON certonly --webroot -w /var/www/html -d $2
# chown -R root:letsencrypt /etc/letsencrypt
# chmod -R 6775 /etc/letsencrypt
"$0" service haproxy start