vhost-stack/bin/vhost-disable.sh

37 lines
849 B
Bash
Raw Normal View History

2021-04-04 13:28:22 -07:00
#!/bin/bash
#
# vhost-stack
# https://git.stack-source.com/msb/vhost-stack
2022-08-22 13:22:16 -07:00
# Copyright (c) 2022 Matthew Saunders Brown <matthewsaundersbrown@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
2021-04-04 13:28:22 -07:00
2021-04-04 14:15:16 -07:00
# load include file
source $(dirname $0)/vhost.sh
2021-04-04 13:28:22 -07:00
2021-09-16 16:21:35 -07:00
help()
{
thisfilename=$(basename -- "$0")
echo "Disable Apache config for specified virtualhost."
echo ""
2021-10-05 11:33:24 -07:00
echo "usage: $thisfilename -d <domain>"
2021-09-16 16:21:35 -07:00
echo ""
echo " -h Print this help."
2021-10-05 11:33:24 -07:00
echo " -d <domain> Domain name of VirtualHost to remove."
2021-09-16 16:21:35 -07:00
exit
}
2021-10-05 11:33:24 -07:00
vhost:getoptions "$@"
# check for domain (virtualhost)
if [[ -z $domain ]]; then
echo "domain is required"
exit 1
2021-04-04 13:28:22 -07:00
fi
2021-10-05 11:33:24 -07:00
if [[ -h /etc/apache2/sites-enabled/$domain.conf ]]; then
a2dissite --quiet $domain
else
echo "$domain is not enabled, nothing to do"
exit 1
2021-08-14 13:04:46 -07:00
fi