转载自:https://www.cnblogs.com/caoyf1992/p/8251209.html
仅作为参考
1 #!/bin/bash 2 #Date 2017/11/11 3 #mail caoyf1992@163.com 4 [ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && exit 1 5 export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 6 sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config 7 setenforce 0 8 which ntpdate 9 if [ $? -eq 0 ];then 10 /usr/sbin/ntpdate time1.aliyun.com 11 echo "*/5 * * * * /usr/sbin/ntpdate -s time1.aliyun.com">>/var/spool/cron/root 12 else 13 yum install ntpdate -y 14 /usr/sbin/ntpdate time1.aliyun.com 15 echo "*/5 * * * * /usr/sbin/ntpdate -s time1.aliyun.com">>/var/spool/cron/root 16 fi 17 clear 18 echo "##########################################" 19 echo "Auto Install smokeping-2.6.11 ##" 20 echo "Press Ctrl + C to cancel ##" 21 echo "Any key to continue ##" 22 echo "##########################################" 23 read -n 1 24 /etc/init.d/iptables status >/dev/null 2>&1 25 if [ $? -eq 0 ] 26 then 27 iptables -I INPUT -p tcp --dport 80 -j ACCEPT && 28 iptables-save >/dev/null 2>&1 29 else 30 echo -e "