From 9aa1439a535e2b3b1b6f172dc7e1c44694974ec7 Mon Sep 17 00:00:00 2001 From: xiaoz Date: Sat, 27 Jul 2019 16:39:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 13 +++++++++++-- install.sh | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ synctime.sh | 12 +++++++----- 3 files changed, 71 insertions(+), 7 deletions(-) create mode 100644 install.sh diff --git a/README.md b/README.md index b56c622..e88649b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,11 @@ -# shell -平时写的各种linux shell脚本 +# shell工具箱 + +### 环境要求 + +* CentOS 7 + +### 使用方法 +``` +yum -y install git +git clone https://github.com/helloxz/mping.git ./shell && cd shell && bash install.sh +``` diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..60c03b7 --- /dev/null +++ b/install.sh @@ -0,0 +1,53 @@ +#!/bin/bash +########## Shell多合一工具箱 ########## +########## Author:xiaoz ########## +########## Update:2019-07-27 ########## + +echo '' +echo '-------------------------------------------------' +echo ""; +echo ' 多合一Shell工具箱 ' +echo "" +echo '-------------------------------------------------' + +echo '1) 安装BBR' +echo '2) 安装Zabbix Agent' +echo '3) 安装Python3' +echo '4) 设置时区(Shanghai)并自动同步' +echo '5) Bench.sh测试' +echo '6) 安装XCDN' +echo '7) Mping测试' +echo '-------------------------------------------------' + +read -p "请输入要执行的脚本:" num + +case $num in + '1') + bash ./bbr.sh + ;; + '2') + bash ./zabbix_agent.sh + ;; + '3') + bash ./python3.sh + ;; + '4') + bash ./synctime.sh + ;; + '5') + yum -y install wget curl + wget -qO- bench.sh | bash + ;; + '6') + yum -y install wget curl + wget https://raw.githubusercontent.com/helloxz/nginx-cdn/master/nginx.sh && bash nginx.sh + ;; + '7') + yum -y install wget + wget https://raw.githubusercontent.com/helloxz/mping/master/mping.sh && bash mping.sh + ;; + *) + echo '参数错误!' + exit; + ;; +esac \ No newline at end of file diff --git a/synctime.sh b/synctime.sh index 9451bfb..8662c5b 100644 --- a/synctime.sh +++ b/synctime.sh @@ -1,11 +1,13 @@ #!/bin/bash ##### CentOS一键同步时间 ##### ##### Author:xiaoz.me ##### -##### Update:2018-01-19 ##### +##### Update:2019-07-27 ##### -#放行端口 -sed -i "/udp -j DROP/i\-A OUTPUT -p udp -m udp --dport 123 -j ACCEPT" /etc/sysconfig/iptables -service iptables restart +#安装ntpdate +yum -y install ntpdate +#设置时区 +timedatectl set-local-rtc 1 +timedatectl set-timezone Asia/Shanghai #同步时间 ntpdate -u pool.ntp.org @@ -13,6 +15,6 @@ ntpd=(`which ntpdate`) #定时任务 echo "*/20 * * * * ${ntpd} pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root -service crond reload +systemctl reload crond echo "同步成功,当前时间:" date \ No newline at end of file