Update nodemgmt-scripts.sh
This commit is contained in:
@@ -15,7 +15,6 @@ source /opt/idssys/defaults/default.inc
|
|||||||
source /opt/idssys/settings/nodemgmt.conf
|
source /opt/idssys/settings/nodemgmt.conf
|
||||||
source /opt/idssys/nodemgmt/defaults.inc
|
source /opt/idssys/nodemgmt/defaults.inc
|
||||||
|
|
||||||
|
|
||||||
# ========================================================= #
|
# ========================================================= #
|
||||||
|
|
||||||
STATUS() {
|
STATUS() {
|
||||||
@@ -60,11 +59,7 @@ STATUS() {
|
|||||||
echo -e "${idsCL[Yellow]}-------------------------------------------------------------${idsCL[Default]}"
|
echo -e "${idsCL[Yellow]}-------------------------------------------------------------${idsCL[Default]}"
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
NEWCERT(){
|
||||||
case "$1" in
|
|
||||||
|
|
||||||
|
|
||||||
newcert)
|
|
||||||
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]}"
|
||||||
echo ""
|
echo ""
|
||||||
do_with_root $CERT_DAEMON certonly --webroot -w /var/www/html -d $2
|
do_with_root $CERT_DAEMON certonly --webroot -w /var/www/html -d $2
|
||||||
@@ -74,10 +69,9 @@ case "$1" in
|
|||||||
echo ""
|
echo ""
|
||||||
sleep 20
|
sleep 20
|
||||||
${FOLDER}/nodemgmt-scripts.sh service nginx reload
|
${FOLDER}/nodemgmt-scripts.sh service nginx reload
|
||||||
exit 0
|
}
|
||||||
;;
|
|
||||||
|
|
||||||
certrenew)
|
CERTRENEW(){
|
||||||
echo -e "${idsCL[LightGreen]}Renewing Certificates...${idsCL[Default]}"
|
echo -e "${idsCL[LightGreen]}Renewing Certificates...${idsCL[Default]}"
|
||||||
do_with_root $CERT_DAEMON renew --webroot -w /var/www/html 2>&1 | tee /opt/idssys/nodemgmt/cert-renewal.lastrun
|
do_with_root $CERT_DAEMON renew --webroot -w /var/www/html 2>&1 | tee /opt/idssys/nodemgmt/cert-renewal.lastrun
|
||||||
do_with_root chown -R root:letsencrypt /etc/letsencrypt 2>&1 | tee -a /opt/idssys/nodemgmt/cert-renewal.lastrun
|
do_with_root chown -R root:letsencrypt /etc/letsencrypt 2>&1 | tee -a /opt/idssys/nodemgmt/cert-renewal.lastrun
|
||||||
@@ -86,20 +80,18 @@ case "$1" in
|
|||||||
echo ""
|
echo ""
|
||||||
sleep 20
|
sleep 20
|
||||||
${FOLDER}/nodemgmt-scripts.sh service nginx reload 2>&1 | tee -a /opt/idssys/nodemgmt/cert-renewal.lastrun
|
${FOLDER}/nodemgmt-scripts.sh service nginx reload 2>&1 | tee -a /opt/idssys/nodemgmt/cert-renewal.lastrun
|
||||||
exit 0
|
}
|
||||||
;;
|
|
||||||
|
|
||||||
nightlyrenew)
|
NIGHTLYRENEW(){
|
||||||
rm -f /opt/idssys/nodemgmt/cert-renewal.lastrun
|
rm -f /opt/idssys/nodemgmt/cert-renewal.lastrun
|
||||||
do_with_root $CERT_DAEMON renew --webroot -w /var/www/html &>> /opt/idssys/nodemgmt/cert-renewal.lastrun
|
do_with_root $CERT_DAEMON renew --webroot -w /var/www/html &>> /opt/idssys/nodemgmt/cert-renewal.lastrun
|
||||||
do_with_root chown -R root:letsencrypt /etc/letsencrypt &>> /opt/idssys/nodemgmt/cert-renewal.lastrun
|
do_with_root chown -R root:letsencrypt /etc/letsencrypt &>> /opt/idssys/nodemgmt/cert-renewal.lastrun
|
||||||
do_with_root chmod -R 6775 /etc/letsencrypt &>> /opt/idssys/nodemgmt/cert-renewal.lastrun
|
do_with_root chmod -R 6775 /etc/letsencrypt &>> /opt/idssys/nodemgmt/cert-renewal.lastrun
|
||||||
sleep 20
|
sleep 20
|
||||||
${FOLDER}/nodemgmt-scripts.sh service nginx reload &>> /opt/idssys/nodemgmt/cert-renewal.lastrun
|
${FOLDER}/nodemgmt-scripts.sh service nginx reload &>> /opt/idssys/nodemgmt/cert-renewal.lastrun
|
||||||
exit 0
|
}
|
||||||
;;
|
|
||||||
|
|
||||||
delsite)
|
DELSITE(){
|
||||||
DEL_SITE=${2}
|
DEL_SITE=${2}
|
||||||
echo -e "${idsCL[LightRed]}Deleting site '${idsCL[Red]}${DEL_SITE}${idsCL[LightRed]}'...${idsCL[Default]}"
|
echo -e "${idsCL[LightRed]}Deleting site '${idsCL[Red]}${DEL_SITE}${idsCL[LightRed]}'...${idsCL[Default]}"
|
||||||
echo ""
|
echo ""
|
||||||
@@ -129,9 +121,9 @@ case "$1" in
|
|||||||
echo ""
|
echo ""
|
||||||
${FOLDER}/nodemgmt-scripts.sh service nginx reload
|
${FOLDER}/nodemgmt-scripts.sh service nginx reload
|
||||||
echo -e "${idsCL[LightRed]}Site has been deleted.${idsCL[Default]}"
|
echo -e "${idsCL[LightRed]}Site has been deleted.${idsCL[Default]}"
|
||||||
|
}
|
||||||
|
|
||||||
;;
|
NEWSITE(){
|
||||||
newsite)
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-site) NEW_SITE=${2};;
|
-site) NEW_SITE=${2};;
|
||||||
@@ -288,18 +280,9 @@ case "$1" in
|
|||||||
echo "}"
|
echo "}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
exit 1
|
}
|
||||||
;;
|
|
||||||
|
|
||||||
update)
|
STATUS-CHECK(){
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
|
|
||||||
status)
|
|
||||||
STATUS
|
|
||||||
;;
|
|
||||||
|
|
||||||
status-check)
|
|
||||||
if [ "${STATUS_CHECK_EMAIL}" != "" ]; then
|
if [ "${STATUS_CHECK_EMAIL}" != "" ]; then
|
||||||
if [ ! -z ${LOCAL_SERVICES+x} ]; then
|
if [ ! -z ${LOCAL_SERVICES+x} ]; then
|
||||||
lip=$(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1)
|
lip=$(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1)
|
||||||
@@ -335,9 +318,9 @@ case "$1" in
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
}
|
||||||
|
|
||||||
set-permissions)
|
SET-PERMISSIONS(){
|
||||||
if [ "${2}" != "" ]; then
|
if [ "${2}" != "" ]; then
|
||||||
NEW_SITE=${2}
|
NEW_SITE=${2}
|
||||||
echo -e "${idsCL[Yellow]}Setting new site folder permissions for (/var/www/${NEW_SITE})${idsCL[Default]}"
|
echo -e "${idsCL[Yellow]}Setting new site folder permissions for (/var/www/${NEW_SITE})${idsCL[Default]}"
|
||||||
@@ -375,9 +358,9 @@ case "$1" in
|
|||||||
nid=`expr $nid + 1`
|
nid=`expr $nid + 1`
|
||||||
done
|
done
|
||||||
if [ "${NEW_SITE}" != "" ]; then echo ""; fi
|
if [ "${NEW_SITE}" != "" ]; then echo ""; fi
|
||||||
;;
|
}
|
||||||
|
|
||||||
service)
|
SERVICE(){
|
||||||
if [ "${NM_SERVICES[${2}]}" = "" ]; then
|
if [ "${NM_SERVICES[${2}]}" = "" ]; then
|
||||||
echo -e "${idsCL[Red]}(${2}) is not an allowed service.${idsCL[Default]}"
|
echo -e "${idsCL[Red]}(${2}) is not an allowed service.${idsCL[Default]}"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -420,9 +403,9 @@ service)
|
|||||||
echo ""
|
echo ""
|
||||||
echo -e "${idsCL[Green]}${NM_SERVICES[${2}]} has been ${ADISP}ed${idsCL[Default]}"
|
echo -e "${idsCL[Green]}${NM_SERVICES[${2}]} has been ${ADISP}ed${idsCL[Default]}"
|
||||||
echo ""
|
echo ""
|
||||||
exit 0
|
}
|
||||||
;;
|
|
||||||
gui)
|
GUI(){
|
||||||
while :
|
while :
|
||||||
do
|
do
|
||||||
echo ""
|
echo ""
|
||||||
@@ -464,15 +447,28 @@ service)
|
|||||||
sleep 1;;
|
sleep 1;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
;;
|
}
|
||||||
|
|
||||||
|
if [ ${action-x} ]; then
|
||||||
|
case $action in
|
||||||
|
newcert) NEWCERT;;
|
||||||
|
certrenew) CERTRENEW;;
|
||||||
|
nightlyrenew) NIGHTLYRENEW;;
|
||||||
|
delsite) DELSITE;;
|
||||||
|
newsite) NEWSITE;;
|
||||||
|
update) ;;
|
||||||
|
status) STATUS;;
|
||||||
|
status-check) STATUS-CHECK;;
|
||||||
|
set-permissions) SET-PERMISSIONS;;
|
||||||
|
service) SERVICE;;
|
||||||
*)
|
*)
|
||||||
echo -e "Usage: ${idsCL[Yellow]}nodemgmt${idsCL[Default]} { ${idsCL[Yellow]}service${idsCL[Default]} [service] [action] | ${idsCL[Yellow]}status${idsCL[Default]} | ${idsCL[Yellow]}newcert${idsCL[Default]} [domain(,s)] | ${idsCL[Yellow]}certrenew${idsCL[Default]} }"
|
echo -e "Usage: ${idsCL[Yellow]}nodemgmt${idsCL[Default]} { ${idsCL[Yellow]}service${idsCL[Default]} [service] [action] | ${idsCL[Yellow]}status${idsCL[Default]} | ${idsCL[Yellow]}newcert${idsCL[Default]} [domain(,s)] | ${idsCL[Yellow]}certrenew${idsCL[Default]} }"
|
||||||
echo ""
|
echo ""
|
||||||
echo ""
|
echo ""
|
||||||
exit 0
|
exit 0;;
|
||||||
;;
|
esac
|
||||||
|
else
|
||||||
esac
|
GUI
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
Reference in New Issue
Block a user