zoukankan      html  css  js  c++  java
  • yum自动脚本

    echo -e "33[34mstop server:33[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
    
    
  • 相关阅读:
    HashMap、HashTable与ConcurrentHashMap的区别
    HashMap的扩容机制---resize()
    jdk7中hashmap实现原理和jdk8中hashmap的改进方法总结
    HTML5学习总结——canvas绘制象棋(canvas绘图)
    ShardingJdbc:水平切分
    ShardingSphere:基本概念
    KubeSphere:harbor+gitlab+nexus+springboot流水线部署
    k8s+jenkins:部署SpringCloud微服务
    k8s实现Jenkins的Master-Slave分布式构建
    windows下jar包转成exe执行文件
  • 原文地址:https://www.cnblogs.com/ligao/p/5995505.html
Copyright © 2011-2022 走看看