Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- USER=qwe
- LISTFILE="/var/tmp/.vboxlistmashines"
- case $1 in
- hibernate)
- echo "Hey guy, we are going to suspend to disk!"
- ;;
- suspend)
- su -c "xscreensaver-command -lock" - $USER
- su -c "VBoxManage list runningvms" - $USER | cut -d { -f2 | sed s/}//g >$LISTFILE
- for i in `cat $LISTFILE`; do su -c "VBoxManage controlvm $i savestate" - $USER; done
- echo "Oh, this time we are doing a suspend to RAM. Cool!"
- ;;
- thaw)
- echo "Oh, suspend to disk is over, we are resuming..."
- ;;
- resume)
- for i in `cat $LISTFILE`; do su -c "VBoxManage startvm $i" - $USER; done
- echo "Hey, the suspend to RAM seems to be over..."
- ;;
- *) echo "Somebody is calling me totally wrong."
- ;;
- esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement