vmail-stack/bin/vmail-webmail-disable.sh
Matthew Saunders Brown dc36299dd1 rename to vmail-
2021-04-13 14:13:14 -07:00

29 lines
683 B
Bash
Executable File

#!/bin/bash
#
# vmail-stack
# https://git.stack-source.com/msb/vmail-stack
# MIT License Copyright (c) 2021 Matthew Saunders Brown
# must be root to disable apache config
if [ "$USER" != "root" ]; then
exec su "$0" -- "$@"
fi
# check for and set virtualhost
if [ -n "$1" ]; then
virtualhost=$1
else
echo "virtualhost not set"
exit 1
fi
# disable webmail vhost & restart apache
if [ -h "/etc/apache2/sites-enabled/mail.$virtualhost.conf" ]; then
/usr/sbin/a2dissite --quiet mail.$virtualhost
/usr/bin/systemctl --quiet reload apache2
fi
if [ -f "/etc/apache2/sites-available/mail.$virtualhost.conf" ]; then
rm /etc/apache2/sites-available/mail.$virtualhost.conf
fi