From 9588a210913600eff8a96f161e1b728660f7c2d4 Mon Sep 17 00:00:00 2001 From: Jinnan Wang Date: Tue, 18 Mar 2014 15:54:48 +0800 Subject: [PATCH] =?UTF-8?q?=09=E6=B8=85=E7=90=86=E4=B8=8Entpd=E5=92=8Cntpd?= =?UTF-8?q?ate=E7=9B=B8=E5=85=B3=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 删除ntpd_cron_patch.sh脚本,修改update_time.sh 做为它的替代品。在setup.sh中不再调用ntpd_cron_patch.sh 而改为调用update_time.sh。 --- install_shell/ntpd_cron_patch.sh | 43 -------------------------------- install_shell/update_time.sh | 19 +++++++++++++- setup.sh | 4 +-- 3 files changed, 20 insertions(+), 46 deletions(-) delete mode 100755 install_shell/ntpd_cron_patch.sh diff --git a/install_shell/ntpd_cron_patch.sh b/install_shell/ntpd_cron_patch.sh deleted file mode 100755 index d1796d6..0000000 --- a/install_shell/ntpd_cron_patch.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -if [ -f /var/spool/cron/crontabs/root ];then - grep update_time.sh /var/spool/cron/crontabs/root &> /dev/null - if [ $? = 0 ];then - sed -i '/update_time.sh/d' /var/spool/cron/crontabs/root - echo "*/1 * * * * sysadmin /usr/sbin/update_time.sh" >> /etc/crontab - fi -else - grep update_time.sh /etc/crontab | grep sysadmin &> /dev/null - if [ $? != 0 ];then - echo "*/1 * * * * sysadmin /usr/sbin/update_time.sh" >> /etc/crontab - fi -fi - - -#d5000 cron example -cp d5000_cron_example.sh /opt/ - -#ntp client -if [ -f /usr/sbin/update_time.sh ];then - chmod +x /usr/sbin/update_time.sh - chown sysadmin:sysadmin /usr/sbin/update_time.sh -else - -cat > /usr/sbin/update_time.sh << 'EOF' -#!/bin/bash -NTPSERVER_A='' -NTPSERVER_B='' -NTPDATE='/usr/sbin/ntpdate' -${NTPDATE} ${NTPSERVER_A} || ${NTPDATE} ${NTPSERVER_B} -hwclock -w -EOF - - ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime - chmod +x /usr/sbin/update_time.sh - chown sysadmin:sysadmin /usr/sbin/update_time.sh -fi - -#ntp server -sed -i '/ntps1*/d' /etc/ntp/ntp.conf -sed -i '/ntp1*/d' /etc/ntp/ntp.conf - diff --git a/install_shell/update_time.sh b/install_shell/update_time.sh index 3755d16..afd15fd 100755 --- a/install_shell/update_time.sh +++ b/install_shell/update_time.sh @@ -1,2 +1,19 @@ -#!/bin/sh +#!/bin/bash + +#ntp client +if [ -f /usr/sbin/update_time.sh ];then + rm /usr/sbin/update_time.sh +fi + +cat > /usr/sbin/update_time.sh << 'EOF' +#!/bin/bash hwclock -w +EOF + +chmod +x /usr/sbin/update_time.sh +chown sysadmin:sysadmin /usr/sbin/update_time.sh + +#ntp server +sed -i '/ntps1*/d' /etc/ntp/ntp.conf +sed -i '/ntp1*/d' /etc/ntp/ntp.conf + diff --git a/setup.sh b/setup.sh index 10752c2..7f5a581 100755 --- a/setup.sh +++ b/setup.sh @@ -22,8 +22,8 @@ echo "====Set Bonding..." ./set_ssh.sh $1 $2 $3 echo "====Set ssh...." -./ntpd_cron_patch.sh -echo "====Set ntp client..." +./update_time.sh +echo "====Set update time...." ./set_fonts.sh echo "====add fonts===="