Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15949508
a simple VBoxManage wrapper
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
dduvall
Mar 21 2018, 6:20 PM
2018-03-21 18:20:43 (UTC+0)
Size
572 B
Referenced Files
None
Subscribers
None
a simple VBoxManage wrapper
View Options
#!/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
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5653858
Default Alt Text
a simple VBoxManage wrapper (572 B)
Attached To
Mode
P6877 a simple VBoxManage wrapper
Attached
Detach File
Event Timeline
Log In to Comment