vhost-stack/bin/vhost-disable.sh
2021-09-16 16:21:35 -07:00

37 lines
756 B
Bash
Executable File

#!/bin/bash
#
# vhost-stack
# https://git.stack-source.com/msb/vhost-stack
# MIT License Copyright (c) 2021 Matthew Saunders Brown
# load include file
source $(dirname $0)/vhost.sh
help()
{
thisfilename=$(basename -- "$0")
echo "Disable Apache config for specified virtualhost."
echo ""
echo "usage: $thisfilename virtualhost"
echo ""
echo " -h Print this help."
exit
}
# check for and set virtualhost
if [ -n "$1" ]; then
if [ $1 == "-h" ]; then
help
else
virtualhost="${1,,}"
shift
fi
else
echo "virtualhost not set"
exit 1
fi
if [[ -h /etc/apache2/sites-enabled/$virtualhost.conf ]]; then
a2dissite --quiet $virtualhost && systemctl --quiet is-active apache2 && systemctl --quiet reload apache2
fi