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
    
    
  • 相关阅读:
    sql语句最后一行显示统计。
    Win10访问不到XP共享的解决:
    git-github-TortoiseGit综合使用教程(二)快速入门
    git-github-TortoiseGit综合使用教程(一)简介
    RHEL7 -- 修改主机名
    安装完 MySQL 后必须调整的 10 项配置(转)
    my.cnf
    mysql查看系统参数
    MySQL性能的五大配置参数(内存参数)
    (转)Linux用户登录记录日志和相关查看命令汇总
  • 原文地址:https://www.cnblogs.com/ligao/p/5995505.html
Copyright © 2011-2022 走看看