[fix] Disable/stop previous email services only if we are forcing conf regeneration

This commit is contained in:
kload 2015-10-31 19:38:08 +01:00
parent 12127d1a71
commit 0bbff4a416

View file

@ -1,25 +1,33 @@
#!/bin/bash
set -e
# Add new email services
sudo yunohost service add rspamd -l /var/log/mail.log \
# Execute this hook only if we force the configuration regeneration
if [[ "$1" == "True" ]]; then
# Add new email services
sudo yunohost service add rspamd -l /var/log/mail.log \
|| echo "Rspamd is already listed in services"
sudo yunohost service add rmilter -l /var/log/mail.log \
sudo yunohost service add rmilter -l /var/log/mail.log \
|| echo "Rspamd is already listed in services"
sudo yunohost service add memcached \
sudo yunohost service add memcached \
|| echo "Memcached is already listed in services"
# Remove previous email services
sudo yunohost service remove spamassassin \
# Remove previous email services
sudo yunohost service remove spamassassin \
|| echo "Spamassassin is already removed" \
&& sudo systemctl disable spamassassin || true
sudo yunohost service remove amavis \
sudo yunohost service remove amavis \
|| echo "Amavis is already removed" \
&& sudo systemctl disable amavis || true
sudo yunohost service remove postgrey \
sudo yunohost service remove postgrey \
|| echo "Postgrey is already removed" \
&& sudo systemctl disable postgrey || true
systemctl stop spamassassin
systemctl stop amavis
systemctl stop postgrey
fi