From ca3251aaf1ecc82f67c9c1774012abbc1b9bb2bb Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Mon, 22 Apr 2019 17:36:40 +0800 Subject: [PATCH] Let makentp fall back to use ntpd when systemctl is not available. --- xCAT-server/lib/xcat/plugins/makentp.pm | 3 ++- xCAT/postscripts/setupntp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/makentp.pm b/xCAT-server/lib/xcat/plugins/makentp.pm index 35d20ee84..47aeca6cc 100755 --- a/xCAT-server/lib/xcat/plugins/makentp.pm +++ b/xCAT-server/lib/xcat/plugins/makentp.pm @@ -253,7 +253,8 @@ sub process_request { } # Handle chronyd here, - if (-f "/usr/sbin/chronyd") { + if (-x "/usr/sbin/chronyd" && + (-x "/usr/bin/systemctl" || -x "/bin/systemctl")) { send_msg(\%request, 0, "Will configure chronyd instead."); my $cmd = "/install/postscripts/setupntp " . diff --git a/xCAT/postscripts/setupntp b/xCAT/postscripts/setupntp index 75809581a..a95c621da 100755 --- a/xCAT/postscripts/setupntp +++ b/xCAT/postscripts/setupntp @@ -130,6 +130,7 @@ then fi check_executes chronyd >/dev/null 2>&1 || USE_NTPD="yes" +check_executes systemctl >/dev/null 2>&1 || USE_NTPD="yes" if [ -n "${USE_NTPD}" ] then