清理与ntpd和ntpdate相关的问题

删除ntpd_cron_patch.sh脚本,修改update_time.sh
	做为它的替代品。在setup.sh中不再调用ntpd_cron_patch.sh
	而改为调用update_time.sh。
This commit is contained in:
Jinnan Wang
2014-03-18 15:54:48 +08:00
parent 089b8a41f1
commit 9588a21091
3 changed files with 20 additions and 46 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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===="