Chinaunix首页 | 论坛 | 博客
  • 博客访问: 277963
  • 博文数量: 55
  • 博客积分: 2535
  • 博客等级: 少校
  • 技术积分: 585
  • 用 户 组: 普通用户
  • 注册时间: 2008-07-25 16:41
个人简介

Je pense donc je suis.

文章分类

全部博文(55)

文章存档

2014年(11)

2011年(3)

2010年(40)

2009年(1)

我的朋友

分类: LINUX

2011-11-01 23:41:24

#!/bin/bash
#需要先让shutdown免sudo密码, 方法为:
#sudo visudo,加入新行 ALL ALL=NOPASSWD:/sbin/shutdown
#  cd wherethisfile ;sudo chmod +x vbox-xp-autoshutdown;  sh vbox-xp-autoshudown


VBoxManage startvm xp  #开启虚拟机xp, 其中xp为虚拟机的name.
state=$(pgrep VirtualBox)
while [ "$state" != "" ]
do
#echo sleep 60
sleep 10s
state=$(pgrep VirtualBox)
done
echo "一分钟准备,要关机了, 如果要取消, 请按Ctrl+C!!!"
sleep 60s
poff -a
sudo shutdown -h now

阅读(1040) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~