2021-02-10 16:16:23 -08:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# vmail-stack
|
|
|
|
# https://git.stack-source.com/msb/vmail-stack
|
|
|
|
# MIT License Copyright (c) 2021 Matthew Saunders Brown
|
|
|
|
|
|
|
|
# load config
|
2021-03-19 11:58:35 -07:00
|
|
|
source /usr/local/etc/vmail.conf || echo "ERROR: Either you do not have vmail user permissions or the config file is missing." && exit
|
2021-02-10 16:16:23 -08:00
|
|
|
|
|
|
|
# check for and set virtualhost
|
|
|
|
if [ -n "$1" ]; then
|
|
|
|
virtualhost=$1
|
|
|
|
else
|
|
|
|
echo "virtualhost not set"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
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
|