批量下载zabbix安装包

1.获取阿里云镜像zabbix源的源代码

[root@ssh02 ~]# curl https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/ >zabbix.txt

2.将网页源代码进行过滤筛选获得包名称

[root@ssh02 ~]# grep ".rpm" zabbix.txt |awk -F '"' '{print $2}'

3.将下载的url和文件名称拼接,通过wget下载

[root@ssh02 scripts]# cat zabbix-down.sh 
#!/bin/bash
#Author: Qjp.com
#QQ: 1532810249
#Date: 2019-11-02
#FileName: zabbix-down.sh
#URL: https://www.qinjianpeng.top
#Description: 

zabbix_name=$(grep ".rpm" zabbix.txt |awk -F '"' '{print $2}')
get_url=https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/
for i in $zabbix_name
do
    wget -O /opt/$i $get_url$i &>/dev/null
    if [ $? -eq 0 ];then
        echo "$i is ok "
    fi
done 

你可能感兴趣的:(批量下载zabbix安装包)