大佬教程收集整理的这篇文章主要介绍了centos – 从脚本检查yum连接?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
# curl -s --dump-header - `yum repolist rhcd -v | grep Repo-baseurl | awk '{print $2}'` -o /dev/null http/1.1 200 OK Date: Fri,17 May 2013 09:58:30 GMT Server: Apache/2.2.3 (CentOS) Connection: close transfer-encoding: chunked Content-Type: text/html;charset=ISO-8859-1@H_301_1@细分:
yum repolist rhcd -v Loading "fastestmirror" plugin Config time: 0.104 Yum Version: 3.2.22 Loading mirror speeds from cached hostfile Repo-id : rhcd Repo-name : rhcd Repo-status : enabled: Repo-updated: Mon Nov 1 14:37:19 2010 Repo-pkgs : 2,599 Repo-size : 3.7 G Repo-baseurl: http://lochost:81/core_build/il31/centos/5Server/i386/CentOS/@H_301_1@使用grep和pipe提取baseurl以获取url的awk. @H_301_1@使用curl的dump header选项查看http状态:
http/1.1 200 OK Date: Fri,17 May 2013 09:58:30 GMT Server: Apache/2.2.3 (CentOS) Connection: close transfer-encoding: chunked Content-Type: text/html;charset=ISO-8859-1@H_301_1@当然,yum是一个非常好的拼凑python程序,所以我猜你也可以把它作为一个python实用程序一起导入yum的相关位. @H_301_1@如果没有重新命名,yum repolist将列出所有yum存储库.然后,您可以循环处理它们.
以上是大佬教程为你收集整理的centos – 从脚本检查yum连接?全部内容,希望文章能够帮你解决centos – 从脚本检查yum连接?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。