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. C++标准转换运算符

    C++类型转换在实际编程中会经常使用,其实,本质上对象的类型用来解释(interpret)对象.因为,每个对象都占据一块内存空间,这块内存空间存放了一段二进制数据.通过标记该对象的类型,告诉如何看待这 ...

  2. Python图像处理库:Pillow 初级教程

    Python图像处理库:Pillow 初级教程 2014-09-14 翻译 http://pillow.readthedocs.org/en/latest/handbook/tutorial.html ...

  3. 移动端自动化环境搭建-python的安装

    安装python A.安装依赖 由于 Robot Framework 框架是基于 Python 语言开发的,要想使用 Robot Framework 首先需要有 Python环境. B.安装过程 下载 ...

  4. javascript高级程序设计--笔记01

    概述 JavaScript的实现包含三个部分: 1  核心(ECMAScript)   提供核心语言功能 2  文档对象模型(DOM)  一套提供了访问以及操作网页内容的API 3  浏览器对象模型( ...

  5. 【软件工程】电梯调度的初步实现 李亚文&&郭莉莉

    一.开门见山,代码粘 using System; using System.Collections.Generic; using System.Data; using System.Drawing; ...

  6. mysql 更改自动增长字段值的重新设定

    今天在服务器上MYSQL库里的一个表插入数据,主键id是auto_increment自动增长类型的.发现插入的值从2247734开始,而实际上id的最大值才22722,不明原因. 删除了新增的,opt ...

  7. SqlServer2008R2附件数据库失败

    MSSQL附加数据库时提示以下错误: 无法打开物理文件“***.mdf”.操作系统错误 5:“5(拒绝访问.)”. (Microsoft SQL Server,错误: 5120) 该经验介绍如何处理该 ...

  8. Dynamic CRM2016在一台本地服务器安装部署

    在本地单独一台服务器上安装部署CRM2016时需要提前安装好CRM软件需要的必备软件,具体需要安装的组件如下截图:其中required为必须具备的安装组件.license可以采用微软官网的90天测试版 ...

  9. 使用Resource Owner Password Credentials Grant授权发放Token

    对应的应用场景是:为自家的网站开发手机 App(非第三方 App),只需用户在 App 上登录,无需用户对 App 所能访问的数据进行授权. 客户端获取Token: public string Get ...

  10. npoi实现 从固定的行读取数据作为表头并返回datable

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.D ...