平时写的各种linux shell脚本
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
471 B

7 years ago
#!/bin/bash
##### CentOS一键同步时间 #####
##### Author:xiaoz.me #####
##### Update:2018-01-19 #####
#放行端口
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
ntpd=(`which ntpdate`)
#定时任务
echo "*/20 * * * * ${ntpd} pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root
service crond reload
echo "同步成功,当前时间:" date