基於http的軟件倉庫
阿新 • • 發佈:2018-09-13
zabb cti ESS 倉庫 在服務器 zab mys 技術分享 mysq
這是企業中常用的方法
比如一臺服務器準備好了,公司必然要安裝一些應用
這時可以用這種方法批量安裝應用
運行一條命令,服務器就會自己去連接軟件倉庫,去下載來安裝。
[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這個腳本並執行
基於http的軟件倉庫