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