#!/bin/bash ########### 时间同步脚本 ########### #放行端口 sed -i "/udp -j DROP/i\-A OUTPUT -p udp -m udp --dport 123 -j ACCEPT" /etc/sysconfig/iptables service iptables restart #同步时间 ntpdate -u pool.ntp.org #加入定时任务 echo "*/20 * * * * /sbin/ntpdate pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root service crond reload echo "Synchronous success,The current time:" date #删除该脚本 rm -rf ./time.sh