From b3ef39e2eeaf494057a64d4cde2e84adcfa5ccf1 Mon Sep 17 00:00:00 2001 From: guessi Date: Mon, 25 Apr 2016 11:14:43 +0800 Subject: [PATCH] Fix `restartservice` failure for systemd Ubuntu 16.04 LTS service manager have been switched to systemd, HTTP service name should be apache2 on Ubuntu, but not httpd. Signed-off-by: guessi --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2b8f8f19f1..f1549fc44b 100644 --- a/Makefile +++ b/Makefile @@ -140,7 +140,11 @@ restartservices: /sbin/service apache2 restart; \ fi; \ elif [ -x /bin/systemctl ]; then \ - /bin/systemctl restart httpd.service; \ + if [ -d /lib/systemd/system/apache2.service.d ]; then \ + /bin/systemctl restart apache2.service; \ + else \ + /bin/systemctl restart httpd.service; \ + fi \ else \ /usr/sbin/service cobblerd restart; \ /usr/sbin/service apache2 restart; \