zoukankan      html  css  js  c++  java
  • 基于http的软件仓库

    这是企业中常用的方法

    比如一台服务器准备好了,公司必然要安装一些应用

    这时可以用这种方法批量安装应用  

    运行一条命令,服务器就会自己去连接软件仓库,去下载来安装。

    [root@webmaster html]# ll
    total 2680
    -rw-r--r-- 1 root root     788 Sep 13 17:40 update_zabbix_agent.sh
    -rw-r--r-- 1 root root 2737299 Sep 13 14:56 zabbix_agent.zip
    #一个开启autoindex的nginx
    #创建一个安装软件的脚本
    

     

    使用者可以通过网页查看相关内容

    [root@webmaster html]# cat update_zabbix_agent.sh 
    #!/bin/sh
    cd /app
    if [ -e "/app/zabbix_agent.zip" ]
    then
        sleep 5
        echo '1'
        rm -f /app/zabbix_agent.zip
    fi
    if [ -d "/app/zabbix" ]
    then
        rm -fr /app/zabbix
    fi
    wget --tries=2 http://192.168.10.10/zabbix_agent.zip >>/tmp/update.`date +%Y%m%d-%H`.log
    
    #update zabbix agent
    echo '-------------------------'
    unzip  zabbix_agent.zip >/dev/null && echo "zabbix directory downloaded sucessfully"
    cd zabbix
    ./sbin/zabbix_agentd -c etc/zabbix_agentd.conf >>/tmp/update.zabbix.`date +%Y%m%d-%H`.log
    if [ $? == 0 ]
    then
        echo "zabbix agent update success"
        echo "zabbix agent update success" >>/tmp/update.`date +%Y%m%d-%H`.log
    else
        echo "zabbix agent update failed"
        echo "zabbix agent update failed" >>/tmp/update.`date +%Y%m%d-%H`.log
    fi
    

      

    [root@mysql app]# wget -O update_zabbix_agent.sh  http://192.168.10.10/update_zabbix_agent.sh;sh update_zabbix_agent.sh
    --2018-09-14 01:39:38--  http://192.168.10.10/update_zabbix_agent.sh
    Connecting to 192.168.10.10:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 788 [application/octet-stream]
    Saving to: ‘update_zabbix_agent.sh’
    
    100%[================================================================================================>] 788         --.-K/s   in 0s      
    
    2018-09-14 01:39:38 (63.3 MB/s) - ‘update_zabbix_agent.sh’ saved [788/788]
    
    1
    --2018-09-14 01:39:43--  http://192.168.10.10/zabbix_agent.zip
    Connecting to 192.168.10.10:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 2737299 (2.6M) [application/zip]
    Saving to: ‘zabbix_agent.zip’
    
    100%[================================================================================================>] 2,737,299   --.-K/s   in 0.02s   
    
    2018-09-14 01:39:43 (112 MB/s) - ‘zabbix_agent.zip’ saved [2737299/2737299]
    
    -------------------------
    zabbix directory downloaded sucessfully
    zabbix agent update success
    -------------------------
    #在服务器上wget这个脚本并执行
    

      

  • 相关阅读:
    2017-2018 ACM-ICPC, NEERC, Northern Subregional Contest C
    Codeforces Round #445 div.2 D. Restoration of string 乱搞
    hdu 6228 Tree
    数塔(入门级dp)
    逆序数(归并排序和树状数组)
    poj2104 K-th Number 主席树入门;
    Codeforces Round #466 (Div. 2)F. Machine Learning 离散化+带修改的莫队
    Codeforces Round #470 (rated, Div. 2, based on VK Cup 2018 Round 1)C. Producing Snow+差分标记
    2038: [2009国家集训队]小Z的袜子(hose)+莫队入门
    Codeforces Round #220 (Div. 2)D. Inna and Sequence 树状数组+二分
  • 原文地址:https://www.cnblogs.com/jabbok/p/9642020.html
Copyright © 2011-2022 走看看