Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P6877
a simple VBoxManage wrapper
Active
Public
Actions
Authored by
•
dduvall
on Mar 21 2018, 6:20 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F15949508: a simple VBoxManage wrapper
Mar 21 2018, 6:20 PM
2018-03-21 18:20:43 (UTC+0)
Subscribers
None
#!/usr/bin/ruby
action
,
name
=
*
ARGV
abort
"usage:
#{
$PROGRAM_NAME
}
[start|stop|halt] vm"
unless
action
&&
name
vm
=
`VBoxManage list vms`
.
each_line
.
map
do
|
l
|
l
.
split
(
' '
)
.
first
.
split
(
'"'
)
[
1
]
end
.
find
do
|
vm
|
name
.
casecmp
(
vm
)
==
0
end
abort
"vm `
#{
name
}
' not found"
unless
vm
case
action
when
"start"
puts
"Starting VM
#{
vm
}
..."
Process
.
detach
Kernel
.
spawn
(
"VBoxHeadless"
,
"-s"
,
vm
)
when
"stop"
puts
"Stopping VM
#{
vm
}
..."
`VBoxManage controlvm
#{
vm
}
savestate`
when
"halt"
puts
"Halting VM
#{
vm
}
..."
`VBoxManage controlvm
#{
vm
}
acpipowerbutton`
end
Event Timeline
•
dduvall
edited the content of this paste.
(Show Details)
Mar 21 2018, 6:20 PM
2018-03-21 18:20:43 (UTC+0)
•
dduvall
changed the title of this paste from untitled to
a simple VBoxManage wrapper
.
•
dduvall
updated the paste's language from
autodetect
to
autodetect
.
Log In to Comment