From c86b4bda9658eb74be5f4bf9932fd17571792fbb Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 12 Aug 2014 08:36:44 -0700 Subject: [PATCH] fix defect #4245 In rhels 7 env,setupntp script will show error message --- xCAT/postscripts/setupntp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/xCAT/postscripts/setupntp b/xCAT/postscripts/setupntp index ec2149bc4..87313cdf6 100755 --- a/xCAT/postscripts/setupntp +++ b/xCAT/postscripts/setupntp @@ -166,11 +166,15 @@ restrict 127.0.0.1" >>$conf_file elif [ -f "/etc/debian_version" ];then sed -i 's/.*UTC.*/UTC=yes/' /etc/default/rcS else - grep -i "utc" /etc/sysconfig/clock - if [ $? -eq 0 ];then - sed -i 's/.*UTC.*/UTC=yes/' /etc/sysconfig/clock - else - echo "UTC=yes" >> /etc/sysconfig/clock + if [ -f "/etc/sysconfig/clock" ];then + grep -i "utc" /etc/sysconfig/clock + if [ $? -eq 0 ];then + sed -i 's/.*UTC.*/UTC=yes/' /etc/sysconfig/clock + else + echo "UTC=yes" >> /etc/sysconfig/clock + fi + elif type -P timedatectl >/dev/null 2>&1 ;then + timedatectl set-local-rtc 0 fi fi