vhost-stack/bin/vhost-disable.sh
Matthew Saunders Brown e8570e1a82 reworked getopts
2021-10-05 11:33:24 -07:00

33 lines
747 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 -d <domain>"
echo ""
echo " -h Print this help."
echo " -d <domain> Domain name of VirtualHost to remove."
exit
}
vhost:getoptions "$@"
# check for domain (virtualhost)
if [[ -z $domain ]]; then
echo "domain is required"
exit
fi
if [[ -h /etc/apache2/sites-enabled/$domain.conf ]]; then
a2dissite --quiet $domain && systemctl --quiet is-active apache2 && systemctl --quiet reload apache2
fi