码迷,mamicode.com
首页 > 其他好文 > 详细

脚本练习

时间:2017-04-20 21:46:10      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:脚本练习

#!/bin/bash

case "$1" in

        start)

        virsh start $2

        virt-viewer $2

        ;;

        stop)

        virsh destroy $2

        ;;

        install)

        yum install $2 -y

        ;;

        reset)

        rm -fr /var/lib/libvirt/images/$2.qcow2

        qemu-img creat -f qcow2 -b /var/lib/libvirt/images/$3.qcow2  /var/lib/libvirt/images/$2.qcow2

        virsh start $2

        ;;

        remove)

        yum remove $2

        ;;

        mksnapshoot)

        virsh destroy $2

        virsh undefine $2

        qemu-img creat -f qcow2 -b /var/lib/libvirt/images/$3.qcow2 /var/lib/libvirt/images/$2.qcow2

        ;;

        *)

        echo "ERROR:please input start|stop|install|remove|reset|mksnapshoot after command"

esac

        


脚本练习

标签:脚本练习

原文地址:http://12774272.blog.51cto.com/12764272/1917890

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!