Update nodemgmt-scripts.sh
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
action="$1"
|
action="$1"
|
||||||
VERS='1.01272019'
|
VERS='1.01272019'
|
||||||
CERT_DAEMON='/usr/bin/certbot'
|
CERT_DAEMON='/usr/bin/certbot'
|
||||||
|
SCRIUPT=
|
||||||
|
|
||||||
source /opt/idssys/nodemgmt/settings.conf
|
source /opt/idssys/nodemgmt/settings.conf
|
||||||
source /opt/idssys/defaults/colors.inc
|
source /opt/idssys/defaults/colors.inc
|
||||||
@@ -19,19 +20,19 @@ unset IFS
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
service)
|
service)
|
||||||
if [ "$2" = "nginx" ]; then SER='NGINX'
|
if [ "$2" = "nginx" ]; then SER='NGINX'
|
||||||
elif [ "$2" = "haproxy" ]; then SER='HAProxy'
|
elif [ "$2" = "haproxy" ]; then SER='HAProxy'
|
||||||
elif [ "$2" = "gogs" ]; then SER='Gogs'
|
elif [ "$2" = "gogs" ]; then SER='Gogs'
|
||||||
fi
|
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} ${ADSIP}ing]]${idsCL[Default]}"
|
||||||
echo -e "${idsCL[LightGreen]}[[${SER} ${STA}ing]]${idsCL[Default]}"
|
|
||||||
echo -e "${idsCL[LightGreen]}-------------------------------------------${idsCL[Default]}"
|
echo -e "${idsCL[LightGreen]}-------------------------------------------${idsCL[Default]}"
|
||||||
|
|
||||||
nid=1
|
nid=1
|
||||||
for nip in "${NODE_HOSTS[@]}"
|
for nip in "${NODE_HOSTS[@]}"
|
||||||
do
|
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
|
ssh root@${nip} systemctl $3 $2
|
||||||
if [[ $(ssh root@${nip} ps -ef | grep -c ${2}) -ne 1 ]]; then
|
if [[ $(ssh root@${nip} ps -ef | grep -c ${2}) -ne 1 ]]; then
|
||||||
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
|
echo -e "${idsCL[Green]}OK${idsCL[Default]}"
|
||||||
@@ -41,7 +42,7 @@ case "$1" in
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${idsCL[Green]}${SER} has been ${STA}ed${idsCL[Default]}"
|
echo -e "${idsCL[Green]}${SER} has been ${ADISP}ed${idsCL[Default]}"
|
||||||
echo ""
|
echo ""
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
@@ -49,9 +50,9 @@ case "$1" in
|
|||||||
newcert)
|
newcert)
|
||||||
|
|
||||||
"$0" service haproxy stop
|
"$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 --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
|
# chown -R root:letsencrypt /etc/letsencrypt
|
||||||
# chmod -R 6775 /etc/letsencrypt
|
# chmod -R 6775 /etc/letsencrypt
|
||||||
"$0" service haproxy start
|
"$0" service haproxy start
|
||||||
|
|||||||
Reference in New Issue
Block a user