zoukankan      html  css  js  c++  java
  • Vagrant+

    1, 简单的LAMP 构建:

    # =================
    # bin/bash
    # author Xu
    
    # ===================
    # ++++++++++++++++++++++
    
    # ----------- createFile
    # arg 1 is Filename
    # arg 2 is Contents
    # return 1
    function createFile ()
    {
        if [ -f "./"$1 ];then
        echo "The File "$1" already exists!"
        echo "
        Whether to delete ?"$1"
        (0) NO
        (1) YES
        "
        read -p 1 input
        case $input in
            0)
            exit;;
            1)
            rm $1
            exit;;
        esac
    else
        echo " Create add file "$1".  OK"
        cat>>$1 <<EDF
    $2
    EDF
    fi
        return 1
    }
    
    echo "
    [0] create Vagrantfile;
    [1] chmod + > VirtualBox;
    [2] vagrant up;
    [3] ping ip;
    [4] ssh;
    [5] Url;
    [9] exit;
    "
    
    # Url
    url="192.168.33.11"
    
    read -p 9 input
    case $input in
        0 )
    echo 'Create add file Vagrantfile';
    
    # Create add file Vagrantfile
    vagrantfile="Vagrantfile"
    
    createFile $vagrantfile "Vagrant.configure("2") do |config|
    config.vm.box = "scotch/box"
    config.vm.box_version = "3.5"
    config.vm.network "private_network", ip: $url
    config.vm.synced_folder ".", "/vagrant_data"
    config.vm.synced_folder "public", "/var/www/public"
    end
    "
    #  execution this
    exec sh  "$0" 
    #  ....... vagrant up
    
            exit;;
         1 )
    echo "Add permissions otherwise an error will be reported!"
    for bin in VirtualBox VirtualBoxVM VBoxNetAdpCtl VBoxNetDHCP VBoxNetNAT VBoxHeadless; do
        sudo chmod u+s "/Applications/VirtualBox.app/Contents/MacOS/${bin}"
    done
            exit;;
         2 )
    # 
    rm -rf public && mkdir public && cd public && cat>>index.php<<EDF
    <?php echo phpinfo();?>
    EDF
    vagrant up
            exit;;
         3 )
    vagrant ssh -c ifconfig
            exit;;    
         4 )
    vagrant ssh
            exit;;
         5 )
    echo $url
            exit;;
         9 )
            exit;;
    esac
    View Code

    2,

  • 相关阅读:
    使用_Capistrano_进行自动化部署(2)
    使用 Capistrano 进行自动化部署
    Zend_Framework_1 框架是如何被启动的?
    PHP新版本变化
    Phpstorm 无法自动断点 Exception
    理解希尔排序
    C# Thread 线程
    Unity 依赖注入容器的AOP扩展
    C# 面向切面编程 AOP
    C# 表达式树 Expression
  • 原文地址:https://www.cnblogs.com/q1104460935/p/11728998.html
Copyright © 2011-2022 走看看