* Hopefully fixed spacing

* Added --servicename argument
This commit is contained in:
Lutchy Horace 2021-11-09 08:20:22 -05:00
parent 97199fc9f5
commit d241024593
1 changed files with 21 additions and 15 deletions

View File

@ -21,6 +21,8 @@ function usage
echo " Description of VHosts" echo " Description of VHosts"
echo " --denotredirect" echo " --denotredirect"
echo " Do not redirect HTTP to HTTPS" echo " Do not redirect HTTP to HTTPS"
echo " --servicename"
echo " The Nginx server service name to use to reload"
echo " -d | --debug" echo " -d | --debug"
echo " Enable debug logging" echo " Enable debug logging"
echo " -h | --help" echo " -h | --help"
@ -42,8 +44,8 @@ function get_cert
function reload_nginx function reload_nginx
{ {
echo -n "Reloading Nginx..." echo -n "Reloading ${_servicename}..."
if systemctl reload nginx > /dev/null 2>&1; then if systemctl reload ${_servicename} > /dev/null 2>&1; then
echo "Success" echo "Success"
else else
echo "Failed" echo "Failed"
@ -109,7 +111,7 @@ fi
# gain priviledges # gain priviledges
become "$@" become "$@"
OPTS=$(getopt -o h,d -l domain:,root:,backend:,listenip:,desc:,donotredirect,debug -n 'createVhosts' -- "$@") OPTS=$(getopt -o h,d -l domain:,root:,backend:,listenip:,desc:,donotredirect,servicename:,debug -n 'createVhosts' -- "$@")
if [ "$?" -gt '0' ]; then if [ "$?" -gt '0' ]; then
echo 'Failed to set command line arguments' echo 'Failed to set command line arguments'
exit 1; exit 1;
@ -123,6 +125,7 @@ _root=""
_backend="" _backend=""
_listenip="" _listenip=""
_debug=false _debug=false
_servicename=nginx
while true; do while true; do
case "$1" in case "$1" in
--domain ) --domain )
@ -143,6 +146,9 @@ while true; do
--donotredirect ) --donotredirect )
_donotredirect=true _donotredirect=true
shift ;; shift ;;
--servicename )
_servicename=$2
shift ;;
-d | --debug ) -d | --debug )
_debug=true _debug=true
shift ;; shift ;;