zoukankan      html  css  js  c++  java
  • 脚本

    # 跳板机
    ```bash
    #自动切换终端脚本,脚本不认识别名(ll),判断里面不能接 >/dev/null,不然会夯住
    vim QH.sh
    #脚本1
    #!/bin/bash
    cat <<EOF
    +------------+
    |1.连接web01 |
    +------------+
    |2.连接web02 |
    +------------+
    |3.连接nfs   |
    +------------+
    |4.连接backup|
    +------------+
    EOF
    read -p '请输入想要连接的虚拟机的序号:' num
    
    if    [ $num -eq 1 ];then
    	ssh root@172.16.1.7
    elif  [ $num -eq 2 ];then
    	ssh root@172.16.1.8 
    elif  [ $num -eq 3 ];then
     	ssh root@172.16.1.31 
    elif  [ $num -eq 4 ];then
    	ssh root@172.16.1.41 
    fi
    
    # if    [ $num -eq 1 -o $num == web01 ];then	不能这样写
    
    #脚本2
    #!/bin/bash
    cat <<EOF
    +------------+
    |1.连接web01 |
    +------------+
    |2.连接web02 |
    +------------+
    |3.连接nfs   |
    +------------+
    |4.连接backup|
    +------------+
    EOF
    read -n1 -p "请输入想要连接的虚拟机的序号: " answer
    case $answer in
    1)
          ssh root@172.16.1.7;;
    2)
          ssh root@172.16.1.8;;
    3)
          ssh root@172.16.1.31;;
    4)
          ssh root@172.16.1.41;;
    esac
    exit 0
    
    #脚本3
    vim jumpserver.sh
    #!/bin/bash
    #jumpserver
    lb01=172.16.1.5
    lb02=172.16.1.6
    web01=172.16.1.7
    web02=172.16.1.8
    web03=172.16.1.9
    nfs=172.16.1.31
    backup=172.16.1.41
    db01=172.16.1.51
    db02=172.16.1.52
    db03=172.16.1.53
    db04=172.16.1.54
    m01=172.16.1.61
    zabbix=172.16.1.71
    
    cat <<EOF
            +-------------------------+
            |     1) lb01             |
            |     2) lb02             |
            |     3) web01            |
            |     4) web02            |
            |     5) web03            |
            |     6) nfs              |
            |     7) backup           |
            |     8) db01             |
            |     9) db02             |
            |     10) db03            |
            |     11) db04            |
            |     12) m01             |
            |     13) zabbix          |
            |     h) help             |
            +-------------------------+
    EOF
    read -p 'Please Input Number: ' num
    
    if [ $num -eq 1 ];then
      ssh root@$lb01
    elif [ $num -eq 2 ];then
      ssh root@$lb02
    elif [ $num -eq 3 ];then
      ssh root@$web01
    elif [ $num -eq 4 ];then
      ssh root@$web02
    elif [ $num -eq 5 ];then
      ssh root@$web03
    elif [ $num -eq 6 ];then
      ssh root@$nfs
    elif [ $num -eq 7 ];then
      ssh root@$backup
    elif [ $num -eq 8 ];then
      ssh root@$db01
    elif [ $num -eq 9 ];then
      ssh root@$db02
    elif [ $num -eq 10 ];then
      ssh root@$db03
    elif [ $num -eq 11 ];then
      ssh root@$db04
    elif [ $num -eq 12 ];then
      ssh root@$m01
    elif [ $num -eq 13 ];then
      ssh root@$zabbix
    fi
    
  • 相关阅读:
    PLSQL配置介绍
    jquery实现无外边框table
    以太坊白皮书
    区块链技术教程,如何从零开始学习以太坊及区块链
    Python机器学习中文版
    史上最全TensorFlow学习资源汇总
    什么是人工智能?终于说明白了
    Python 语音识别
    Step by Step 真正从零开始,TensorFlow详细安装入门图文教程!帮你完成那个最难的从0到1
    什么是加密经济学? 初学者终极指南
  • 原文地址:https://www.cnblogs.com/syy1757528181/p/12883785.html
Copyright © 2011-2022 走看看