zoukankan      html  css  js  c++  java
  • linux 添加vmware workstation14开机自启动虚拟机

    (一). 编写脚本vmrun.sh,脚本内容如下:
    [root@localhost ~]# vi vmrun.sh
    #!/bin/sh
    #chkconfig: 2345 80 90
    #description:开机自动启动的脚本程序
    #启动vm虚拟机服务
    /usr/bin/vmrun start "/var/kvm/CentOS 7 64-bit/CentOS 7 64-bit.vmx" nogui &
    /usr/bin/vmrun start "/var/kvm/CentOS 6 64-bit/CentOS 6 64-bit.vmx" nogui &
    /usr/bin/vmrun start "/var/kvm/Windows Server 2008 R2 x64/Windows Server 2008 R2 x64.vmx" nogui &
    /usr/bin/vmrun start "/var/kvm/VMware ESXi 6.0/VMware ESXi 6.0.vmx" nogui &

    脚本第一行 “#!/bin/sh” 告诉系统使用的shell;
    脚本第二行 “#chkconfig: 2345 80 90” 表示在2/3/4/5运行级别启动,启动序号(S80),关闭序号(K90);
    脚本第三行 表示的是服务的描述信息

    注意: 第二行和第三行必写,否责会出现如“服务vmrun.sh 不支持 chkconfig”这样的错误。

    (二). 将写好的vmrun.sh脚本移动到/etc/rc.d/init.d/目录下

    [root@localhost ~]# cp vmrun.sh /etc/rc.d/init.d/

    (三).给脚本赋可执行权限

    [root@localhost ~]# cd /etc/rc.d/init.d/
    [root@localhost init.d]# chmod +x vmrun.sh

    (四). 添加脚本到开机自动启动项目中

    [root@localhost init.d]# chkconfig --add vmrun.sh
    [root@localhost init.d]# chkconfig vmrun.sh on

  • 相关阅读:
    网络规划和布线
    网络编程
    NoSQL 非关系数据库
    OpenCV
    首页
    C++关键字
    TCP/IP 详解7 Ping指令
    TCP详解 (1)
    GRE封装解封装过程
    GRE tunnel
  • 原文地址:https://www.cnblogs.com/liqing1009/p/12793589.html
Copyright © 2011-2022 走看看