Browse Source

优化

master
xiaoz 5 years ago
parent
commit
9aa1439a53
  1. 13
      README.md
  2. 53
      install.sh
  3. 12
      synctime.sh

13
README.md

@ -1,2 +1,11 @@
# shell # shell工具箱
平时写的各种linux shell脚本
### 环境要求
* CentOS 7
### 使用方法
```
yum -y install git
git clone https://github.com/helloxz/mping.git ./shell && cd shell && bash install.sh
```

53
install.sh

@ -0,0 +1,53 @@
#!/bin/bash
########## Shell多合一工具箱 ##########
########## Author:xiaoz<xiaoz93@outlook.com> ##########
########## 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

12
synctime.sh

@ -1,11 +1,13 @@
#!/bin/bash #!/bin/bash
##### CentOS一键同步时间 ##### ##### CentOS一键同步时间 #####
##### Author:xiaoz.me ##### ##### Author:xiaoz.me #####
##### Update:2018-01-19 ##### ##### Update:2019-07-27 #####
#放行端口 #安装ntpdate
sed -i "/udp -j DROP/i\-A OUTPUT -p udp -m udp --dport 123 -j ACCEPT" /etc/sysconfig/iptables yum -y install ntpdate
service iptables restart #设置时区
timedatectl set-local-rtc 1
timedatectl set-timezone Asia/Shanghai
#同步时间 #同步时间
ntpdate -u pool.ntp.org 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 echo "*/20 * * * * ${ntpd} pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root
service crond reload systemctl reload crond
echo "同步成功,当前时间:" date echo "同步成功,当前时间:" date
Loading…
Cancel
Save