echo -e "\033[34mstop server:\033[0m"
service iptables stop
service NetworkManager stop
chkconfig --del iptables
chkconfig --del NetworkManager
setenforce 0
cat /etc/redhat-release | cut -d' ' -f3 | cut -d. -f1 >/so.txt
#read -p "Input source.1/2/3:" MI
if [ $(cat /so.txt) -eq 6 ];then
cd /etc/yum.repos.d/
[ -f /etc/yum.repos.d/CentOS-Base.repo ] && mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak && echo "backup local source OK!"
[ -f /etc/yum.repos.d/CentOS6-Base.repo ] && echo "yum source exist" && yum list && exit 4
[ ! -f /etc/yum.repos.d/CentOS6-Base.repo ] && wget http://10.56.126.75/.help/CentOS6-Base.repo
[ -f /etc/yum.repos.d/CentOS6-Base.repo ] && yum clean all &>/dev/null && echo "Clean Yum cache OK" || echo "Loading error."
yum makecache
yum list
rm -rf /so.txt
elif [ $(cat /so.txt) -eq 7 ];then
cd /etc/yum.repos.d/
[ -f /etc/yum.repos.d/CentOS-Base.repo ] && mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak && echo "backup local source OK!"
[ -f /etc/yum.repos.d/CentOS7-Base.repo ] && echo "yum source exist" && exit 4
[ ! -f /etc/yum.repos.d/CentOS7-Base.repo ] && wget http://10.56.126.75/.help/CentOS7-Base.repo
[ -f /etc/yum.repos.d/CentOS7-Base.repo ] && yum clean all &>/dev/null && echo "Clean Yum cache OK" || echo "Loading error." && exit 4
echo "please waiting..."
yum makecahe
yum list
rm -rf /so.txt
elif [ $(cat /so.txt) -eq 5 ];then
[ -f /etc/yum.repos.d/CentOS-Base.repo ] && mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak && echo "backup local source OK!"
[ -f /etc/yum.repos.d/CentOS5-Base.repo ] && echo "yum source exist" && yum list && exit 4
[ ! -f /etc/yum.repos.d/CentOS5-Base.repo ] && wget http://10.56.126.75/.help/CentOS5-Base.repo
[ -f /etc/yum.repos.d/CentOS5-Base.repo ] && yum clean all &>/dev/null && echo "Clean Yum cache OK" || echo "Loading error."
yum makecache
yum list
rm -rf /so.txt else
echo "error option"
exit 4
fi

yum自动脚本的更多相关文章

  1. 无密钥登录的自动脚本实现(ssh-copy-id、expect免交互输入脚本)

    感谢朋友支持本博客,欢迎共同探讨交流,由于能力和时间有限,错误之处在所难免,欢迎指正! 如有转载,请保留源作者博客信息. Better Me的博客:blog.csdn.net/tantexian 如需 ...

  2. 让CentOS能用yum自动安装rar和unrar

    目的:让CentOS能用yum自动安装rar和unrar 系统环境: CentOS 7.0 具体操作步骤如下: 1.编辑文件 编辑dag.repo文件,或者说是新建一个dag.repo文件. vi / ...

  3. 自动脚本工具新版 v2.0

    自动脚本工具 下载 下载工具后,解压,直接双击 "execute.bat" 文件后(前提已配置好 jdk 1.7 的环境),会生成文件夹 "output",该文 ...

  4. showdoc 自动脚本安装

    ========================== showdoc 简介==========================在线文档管理系统很多, 比如阿里的语雀.腾讯的 TAPD 平台也包括文档管 ...

  5. CentOS 7系统关闭yum自动下载更新

    安装CentOS 7后,系统yum自动更新状态默认为开启,若禁止系统自动更新需要手动关闭. 1.进入yum目录 [root@localhost ~]$ cd /etc/yum 2.编辑yum-cron ...

  6. 解剖Nginx·自动脚本篇(6)编译器名称变量脚本 auto/cc/name

    回顾变量 CC 最初是在auto/options脚本中初始化的: CC=${CC:-gcc} 1 C Compiler 的 feature Windows 平台的编译器叫做MSVC,其他平台的都统称为 ...

  7. 解剖Nginx·自动脚本篇(5)编译器相关主脚本

    在 Nginx 的自动脚本中,auto/cc目录下的所有脚本都是用于编译器相关配置使用的.Nginx的出色跨平台性(Linux.Darwin.Solaris.Win32 等)就有这些脚本的贡献.该目录 ...

  8. 解剖Nginx·自动脚本篇(4)工具型脚本系列

    目录 auto/have 向自动配置头文件追加可用宏定义(objs/ngx_auto_config.h) auto/nohave 向自动配置头文件追加不可用宏定义(objs/ngx_auto_conf ...

  9. 解剖Nginx·自动脚本篇(1)解析配置选项脚本 auto/options

    在安装Nginx之前(即运行make脚本之前),首先是进行安装的配置准备,包括环境检查及生成文件.这些工作是由自动脚本完成的.和绝大多数软件一样,Nginx的自动脚本的入口,同样是名为configur ...

随机推荐

  1. 使用jquery获取url以及jquery获取url参数的方法

    使用jquery获取url以及使用jquery获取url参数是我们经常要用到的操作 1.jquery获取url很简单,代码如下 1.window.location.href; 其实只是用到了javas ...

  2. iScroll滚动区域中select、input、textarea元素无法点击的Bug修复

    最近在一个项目中使用了iScroll4模拟滚动效果,调试过程中发现一个表单页中的所有表单项都无法点击聚焦, 如<select>.<input>.<textarea> ...

  3. {Reship}{Matting}Image Matting

    ======================================== http://www.alphamatting.com/index.html ==================== ...

  4. 实现textarea限制输入字数(包含中文只能输入10个,全ASCII码能够输入20个)

    document.getElementById("<%=textBox1.ClientID %>").value 实现textarea限制输入字数(包含中文只能输入10 ...

  5. Diagramming for WinForms 教程一(读取图元数据)

    1,新建“Visual c#” Windows窗体应用程序. 2,从“工具箱”的“Diagramming”选项卡下,托出“DiagramView”控件到Form1上.控件的"Name&quo ...

  6. js window.open() 父窗口与子窗口的互相调用(未必有用)

    javascript 父窗口与子窗口的互相调用 <html> <head></head> <body> 主要实现父子关系的页面 window.opene ...

  7. Java线程池的几种实现 及 常见问题讲解

    工作中,经常会涉及到线程.比如有些任务,经常会交与线程去异步执行.抑或服务端程序为每个请求单独建立一个线程处理任务.线程之外的,比如我们用的数据库连接.这些创建销毁或者打开关闭的操作,非常影响系统性能 ...

  8. 解决 HttpClient 模拟 http 的get 请求后 ,出现 403 错误

    解决方法: URI uri = builder.build(); // 创建http GET请求 HttpGet httpGet = new HttpGet(uri); httpGet.setHead ...

  9. MVC 路由模块内核原理

    .net网站第一次运行的时候 执行global文件的application_start方法 注册路由信息   RouteConfig.RegisterRoutes(RouteTable.Routes) ...

  10. XE3随笔10:TSuperType

    unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...