parent
97199fc9f5
commit
d241024593
|
@ -7,24 +7,26 @@
|
|||
|
||||
function usage
|
||||
{
|
||||
echo "Usage: ${0}"
|
||||
echo " --domain domain.tld"
|
||||
echo " Domain to use when creating vhost"
|
||||
echo "Usage: ${0}"
|
||||
echo " --domain domain.tld"
|
||||
echo " Domain to use when creating vhost"
|
||||
echo " --root /var/www/html"
|
||||
echo " Root directory of this vhost"
|
||||
echo " --backend http://127.0.0.1:80"
|
||||
echo " URI of the backend server"
|
||||
echo " Root directory of this vhost"
|
||||
echo " --backend http://127.0.0.1:80"
|
||||
echo " URI of the backend server"
|
||||
echo " Note: port must be specified"
|
||||
echo " --listenip x.x.x.x"
|
||||
echo " IP to bind to when listening"
|
||||
echo " --desc x.x.x.x"
|
||||
echo " Description of VHosts"
|
||||
echo " --listenip x.x.x.x"
|
||||
echo " IP to bind to when listening"
|
||||
echo " --desc x.x.x.x"
|
||||
echo " Description of VHosts"
|
||||
echo " --denotredirect"
|
||||
echo " Do not redirect HTTP to HTTPS"
|
||||
echo " --servicename"
|
||||
echo " The Nginx server service name to use to reload"
|
||||
echo " -d | --debug"
|
||||
echo " Enable debug logging"
|
||||
echo " -h | --help"
|
||||
echo " Show this usage"
|
||||
echo " -h | --help"
|
||||
echo " Show this usage"
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
@ -42,8 +44,8 @@ function get_cert
|
|||
|
||||
function reload_nginx
|
||||
{
|
||||
echo -n "Reloading Nginx..."
|
||||
if systemctl reload nginx > /dev/null 2>&1; then
|
||||
echo -n "Reloading ${_servicename}..."
|
||||
if systemctl reload ${_servicename} > /dev/null 2>&1; then
|
||||
echo "Success"
|
||||
else
|
||||
echo "Failed"
|
||||
|
@ -109,7 +111,7 @@ fi
|
|||
# gain priviledges
|
||||
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
|
||||
echo 'Failed to set command line arguments'
|
||||
exit 1;
|
||||
|
@ -123,6 +125,7 @@ _root=""
|
|||
_backend=""
|
||||
_listenip=""
|
||||
_debug=false
|
||||
_servicename=nginx
|
||||
while true; do
|
||||
case "$1" in
|
||||
--domain )
|
||||
|
@ -143,6 +146,9 @@ while true; do
|
|||
--donotredirect )
|
||||
_donotredirect=true
|
||||
shift ;;
|
||||
--servicename )
|
||||
_servicename=$2
|
||||
shift ;;
|
||||
-d | --debug )
|
||||
_debug=true
|
||||
shift ;;
|
||||
|
|
Loading…
Reference in New Issue