首页 > 其他 > 详细

脚本练习

时间:2017-04-20 21:47:32      阅读:217      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!