automatically restart services if needed

This commit is contained in:
Matthew Saunders Brown 2023-01-02 09:48:58 -08:00
parent 9374261c80
commit 12c6cd39b1

View File

@ -62,15 +62,19 @@ elif [[ -z $domains_id ]] ; then
# /etc/ configs
if [[ -d /var/vmail/$domain/.exp/etc ]]; then
cp -a /var/vmail/$domain/.exp/etc/* /etc/
# reload dovecot
if [[ -f /etc/dovecot/sites.d/mail.$domain.conf ]]; then
systemctl --quiet reload dovecot.service
fi
# reload apache (webmail)
if [[ -L /etc/apache2/sites-enabled/mail.$domain.conf ]]; then
systemctl --quiet reload apache2.service
fi
fi
echo
echo "Vmail import complete. If it's no longer need you can remove the data dir:"
echo "/var/vmail/$domain/.exp/"
echo
echo "Assuming /etc/ configs were imported you should now reload services with:"
echo "systemctl reload apache2.service dovecot.service"
echo
else
@ -81,14 +85,14 @@ elif [[ -z $domains_id ]] ; then
else
echo "Vmail dir for $domain exists, but there is no .exp data dir."
echo "ERROR: Vmail dir for $domain exists, but there is no .exp data dir."
exit 1
fi
else
echo "$domain exists in vmail db, but /var/vmail/$domain dir does not exist."
echo "ERROR: $domain exists in vmail db, but /var/vmail/$domain dir does not exist."
echo "This script excepts a sync of the /var/vmail/$domain dir and no records in the db."
exit 1