diff --git a/OTcerts.py b/OTcerts.py index 417820c..20741f6 100644 --- a/OTcerts.py +++ b/OTcerts.py @@ -319,12 +319,21 @@ if __name__ == '__main__': logger.error('Error asking certificate for {}'.format(vhost_name)) - if set('webmail','hosting','liste') & set(service_reload.keys()): + if set(['webmail','hosting','liste']) & set(service_reload.keys()): # reload apache - ret = subprocess.run("systemctl reload apache2") - if set('smtp',) & set(service_reload.keys()): + logger.info("Restarting apache") + # ret = subprocess.run("systemctl reload apache2") + ret = os.system("systemctl reload apache2") + logger.info(ret) + if set(['smtp',]) & set(service_reload.keys()): # reload postfix - ret = subprocess.run("systemctl reload postfix") - if set('mbox',) & set(service_reload.keys()): - # reload dovecot - ret = subprocess.run("systemctl reload dovecot") + logger.info("Restarting postfix") + # ret = subprocess.run("systemctl reload postfix") + ret = os.system("systemctl reload postfix") + logger.info(ret) + if set(['mbox',]) & set(service_reload.keys()): + # restart dovecot + logger.info("Restarting dovecot") + # ret = subprocess.run("systemctl restart dovecot") + ret = os.system("systemctl reload dovecot") + logger.info(ret)