From 3c4458bfb066d2763beee8bbe67eff6a52088483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florent=20Thi=C3=A9ry?= <florent.thiery@ubicast.eu> Date: Thu, 1 Jun 2017 10:56:52 +0200 Subject: [PATCH] support journalctl postfix log case --- tests/test_email.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_email.py b/tests/test_email.py index cae12ce3..66f32f9b 100755 --- a/tests/test_email.py +++ b/tests/test_email.py @@ -91,7 +91,11 @@ def send_test_email(): timeout = 120 waited = 2 out = '' - cmd = 'grep "%s" /var/log/mail.log' % email + if os.path.isfile('/var/log/mail.log'): + cmd = 'grep "%s" /var/log/mail.log' % email + else: + print('/var/log/mail.log not found, trying journalctl') + cmd = 'journalctl -u postfix | grep %s' % email while True: status, out = subprocess.getstatusoutput(cmd) if status == 0: -- GitLab