parent
97199fc9f5
commit
d241024593
|
@ -7,24 +7,26 @@
|
||||||
|
|
||||||
function usage
|
function usage
|
||||||
{
|
{
|
||||||
echo "Usage: ${0}"
|
echo "Usage: ${0}"
|
||||||
echo " --domain domain.tld"
|
echo " --domain domain.tld"
|
||||||
echo " Domain to use when creating vhost"
|
echo " Domain to use when creating vhost"
|
||||||
echo " --root /var/www/html"
|
echo " --root /var/www/html"
|
||||||
echo " Root directory of this vhost"
|
echo " Root directory of this vhost"
|
||||||
echo " --backend http://127.0.0.1:80"
|
echo " --backend http://127.0.0.1:80"
|
||||||
echo " URI of the backend server"
|
echo " URI of the backend server"
|
||||||
echo " Note: port must be specified"
|
echo " Note: port must be specified"
|
||||||
echo " --listenip x.x.x.x"
|
echo " --listenip x.x.x.x"
|
||||||
echo " IP to bind to when listening"
|
echo " IP to bind to when listening"
|
||||||
echo " --desc x.x.x.x"
|
echo " --desc x.x.x.x"
|
||||||
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"
|
||||||
echo " Show this usage"
|
echo " Show this usage"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
@ -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 ;;
|
||||||
|
|
Loading…
Reference in New Issue