<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://beardedmaker.com/wiki/index.php?action=history&amp;feed=atom&amp;title=VirtualBox</id>
		<title>VirtualBox - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://beardedmaker.com/wiki/index.php?action=history&amp;feed=atom&amp;title=VirtualBox"/>
		<link rel="alternate" type="text/html" href="https://beardedmaker.com/wiki/index.php?title=VirtualBox&amp;action=history"/>
		<updated>2026-04-20T23:54:58Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.27.4</generator>

	<entry>
		<id>https://beardedmaker.com/wiki/index.php?title=VirtualBox&amp;diff=3277&amp;oldid=prev</id>
		<title>Beard: /* Shutdown Script */</title>
		<link rel="alternate" type="text/html" href="https://beardedmaker.com/wiki/index.php?title=VirtualBox&amp;diff=3277&amp;oldid=prev"/>
				<updated>2019-07-26T16:33:43Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Shutdown Script&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 16:33, 26 July 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l87&quot; &gt;Line 87:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 87:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;I will continue assuming you are using Debian.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;I will continue assuming you are using Debian.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Create the file &amp;lt;code&amp;gt;/lib/systemd/system-shutdown/wait-for-vms.sh&amp;lt;/code&amp;gt;:&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;div class=&amp;quot;red-box&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;div class=&amp;quot;red-box&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[ &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;THIS &lt;/del&gt;SECTION &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;NEEDS TO BE CORRECTED &lt;/del&gt;]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[ &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;UNFINISHED &lt;/ins&gt;SECTION ]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;You actually make script &lt;/del&gt;&amp;lt;code&amp;gt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;scripts&lt;/del&gt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;xxx&lt;/del&gt;.sh&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Create the file &lt;/ins&gt;&amp;lt;code&amp;gt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;lib&lt;/ins&gt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;systemd/system-shutdown/wait-for-vms&lt;/ins&gt;.sh&amp;lt;/code&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;contents&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Then make file &amp;lt;code&amp;gt;/lib/systemd/system/xxx.service&amp;lt;/code&amp;gt; with:&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;contents&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Beard</name></author>	</entry>

	<entry>
		<id>https://beardedmaker.com/wiki/index.php?title=VirtualBox&amp;diff=2499&amp;oldid=prev</id>
		<title>Beard: /* Easier Command Line Management */</title>
		<link rel="alternate" type="text/html" href="https://beardedmaker.com/wiki/index.php?title=VirtualBox&amp;diff=2499&amp;oldid=prev"/>
				<updated>2018-06-07T17:30:17Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Easier Command Line Management&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
== Startup Script ==&lt;br /&gt;
&lt;br /&gt;
I created a file called &amp;lt;code&amp;gt;/autostart-vms.list&amp;lt;/code&amp;gt; that contains the &amp;lt;b&amp;gt;names&amp;lt;/b&amp;gt; of the VMs I want to start (one per line).&lt;br /&gt;
&lt;br /&gt;
I then created this script called &amp;lt;code&amp;gt;/custom-init.sh&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
vm_list=`cat /autostart-vms.list`&lt;br /&gt;
vm_user=&amp;quot;username&amp;quot;&lt;br /&gt;
status_file=&amp;quot;/home/$vm_user/vbox-status.log&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;VM START:&amp;quot; &amp;gt;$status_file&lt;br /&gt;
&lt;br /&gt;
s=$IFS&lt;br /&gt;
IFS=`echo -en &amp;quot;\n\b&amp;quot;`&lt;br /&gt;
for x in $vm_list;do&lt;br /&gt;
        su -c &amp;quot;VBoxManage startvm \&amp;quot;$x\&amp;quot; --type headless &amp;amp;&amp;gt;&amp;gt;$status_file&amp;quot; $vm_user&lt;br /&gt;
done&lt;br /&gt;
IFS=$s&lt;br /&gt;
&lt;br /&gt;
echo -e &amp;quot;\nVM LIST:\n$vm_list&amp;quot; &amp;gt;&amp;gt;$status_file&lt;br /&gt;
&lt;br /&gt;
echo -e &amp;quot;\nRUNNING:&amp;quot; &amp;gt;&amp;gt;$status_file&lt;br /&gt;
su -c &amp;quot;VBoxManage list runningvms &amp;gt;&amp;gt;$status_file&amp;quot; $vm_user&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Username&amp;lt;/b&amp;gt; needs to be some user other than root. This script creates a log file in the user's home directory &amp;lt;code&amp;gt;~/vbox-status.log&amp;lt;/code&amp;gt; that contains status info about the VM startup process on last boot. Make sure this script is started after all the VirtualBox services are started on bootup. Since the &amp;lt;code&amp;gt;/etc/init.d/rc.local&amp;lt;/code&amp;gt; always starts last, I put the line at the bottom. Make sure custom-init.sh is executable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sudo chmod 744 /custom-init.sh&lt;br /&gt;
su -c 'echo &amp;quot;/bin/bash /custom-init.sh &amp;amp;&amp;quot; &amp;gt;&amp;gt; /etc/init.d/rc.local'&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shutdown Script ==&lt;br /&gt;
&lt;br /&gt;
When you shutdown your host server, it would be nice if it also gave the shutdown command to all your VMs. Here is a short script you can save in &amp;lt;code&amp;gt;/etc/init.d&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
vm_user=&amp;quot;username&amp;quot;&lt;br /&gt;
timeout=30&lt;br /&gt;
&lt;br /&gt;
for vm in `su -c 'VBoxManage list runningvms' $vm_user|grep -o &amp;quot;\&amp;quot;.*\&amp;quot;&amp;quot;|sed 's/\&amp;quot;//g'`;do&lt;br /&gt;
        su -c &amp;quot;VBoxManage controlvm \&amp;quot;$vm\&amp;quot; acpipowerbutton&amp;quot; $vm_user&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
echo -n &amp;quot;Waiting for VMs to shutdown.&amp;quot;&lt;br /&gt;
i=1&lt;br /&gt;
while (( $i &amp;lt;= $timeout ));do&lt;br /&gt;
        vm_count=`su -c 'VBoxManage list runningvms' $vm_user|wc -l`&lt;br /&gt;
        if (( $vm_count &amp;lt;= 0 ));then&lt;br /&gt;
                echo &amp;quot; All VMs were shutdown OK.&amp;quot;&lt;br /&gt;
                break&lt;br /&gt;
        else&lt;br /&gt;
                echo -n &amp;quot;.&amp;quot;&lt;br /&gt;
                let i++&lt;br /&gt;
                sleep 1&lt;br /&gt;
        fi&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
if (( $i == $timeout ));then&lt;br /&gt;
        echo &amp;quot; Some VMs did not shutdown!&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Username&amp;lt;/b&amp;gt; must be something other than root. &amp;lt;b&amp;gt;Timeout&amp;lt;/b&amp;gt; is how many seconds (roughtly) that it waits before it gives up on the remaining VMs and just shuts down the host server.&lt;br /&gt;
&lt;br /&gt;
Once you have this script located in &amp;lt;code&amp;gt;/etc/init.d&amp;lt;/code&amp;gt; (named &amp;quot;stop-vms&amp;quot; for example) you can create a symbolic link in the appropriate rc directories. Make sure this script is run before any of the VirtualBox services are stopped. For my server, I made it &amp;lt;b&amp;gt;K64&amp;lt;/b&amp;gt;. Make sure stop-vms is executable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sudo chmod 744 /etc/init.d/stop-vms&lt;br /&gt;
sudo ln -s /etc/init.d/stop-vms /etc/rc0.d/K64stop-vms&lt;br /&gt;
sudo ln -s /etc/init.d/stop-vms /etc/rc6.d/K64stop-vms&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;If you're using Systemd&amp;lt;/b&amp;gt; you need to do this differently.&lt;br /&gt;
&lt;br /&gt;
You can put a script in the Systemd system-shutdown script folder. It is located in a different place on different Linux distributions:&lt;br /&gt;
* Debian: &amp;lt;code&amp;gt;/lib/systemd/system-shutdown&amp;lt;/code&amp;gt;&lt;br /&gt;
* Other: &amp;lt;code&amp;gt;/usr/lib/systemd/system-shutdown&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I will continue assuming you are using Debian.&lt;br /&gt;
&lt;br /&gt;
Create the file &amp;lt;code&amp;gt;/lib/systemd/system-shutdown/wait-for-vms.sh&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;red-box&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[ THIS SECTION NEEDS TO BE CORRECTED ]&lt;br /&gt;
&lt;br /&gt;
You actually make script &amp;lt;code&amp;gt;/scripts/xxx.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
contents&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then make file &amp;lt;code&amp;gt;/lib/systemd/system/xxx.service&amp;lt;/code&amp;gt; with:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
contents&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Easier Command Line Management ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;VBoxManage&amp;lt;/code&amp;gt; command is very powerful, but a bit difficult to remember the syntax in my opinion. I only use it occasionally, and I use it for simple things. I decided to simplify it.&lt;br /&gt;
&lt;br /&gt;
I created a file called &amp;lt;code&amp;gt;/scripts/vbox-commands.sh&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#&lt;br /&gt;
# A handy shortcut script for controlling VirtualBox VMs.&lt;br /&gt;
#&lt;br /&gt;
# Recommended aliases:&lt;br /&gt;
#   alias vbm='VBoxManage'&lt;br /&gt;
#   alias vb='/scripts/vbox-commands.sh'&lt;br /&gt;
#   alias vbl='/scripts/vbox-commands.sh list'&lt;br /&gt;
#   alias vbll='/scripts/vbox-commands.sh listall'&lt;br /&gt;
#   alias vbla='/scripts/vbox-commands.sh listall'&lt;br /&gt;
#   alias vbls='/scripts/vbox-commands.sh start'&lt;br /&gt;
#   alias vblx='/scripts/vbox-commands.sh stop'&lt;br /&gt;
#   alias vblh='/scripts/vbox-commands.sh halt'&lt;br /&gt;
&lt;br /&gt;
main() {&lt;br /&gt;
case $1 in&lt;br /&gt;
&amp;quot;list&amp;quot;|&amp;quot;listrunningvms&amp;quot;)&lt;br /&gt;
        echo &amp;quot;Running VMs:&amp;quot;&lt;br /&gt;
        VBoxManage list runningvms&lt;br /&gt;
;;&lt;br /&gt;
&amp;quot;listall&amp;quot;|&amp;quot;listvms&amp;quot;)&lt;br /&gt;
        echo &amp;quot;All VMs:&amp;quot;&lt;br /&gt;
        VBoxManage list vms&lt;br /&gt;
;;&lt;br /&gt;
&amp;quot;start&amp;quot;|&amp;quot;startvm&amp;quot;)&lt;br /&gt;
        checkvm &amp;quot;$2&amp;quot;&lt;br /&gt;
        echo -n &amp;quot;Are you sure you want to start headless VM: \&amp;quot;$2\&amp;quot; [y/N]? &amp;quot;;read ans&lt;br /&gt;
        shopt -s nocaseglob&lt;br /&gt;
        if [[ &amp;quot;$ans&amp;quot; == y* ]];then&lt;br /&gt;
                shopt -u nocaseglob&lt;br /&gt;
                func_startvm &amp;quot;$2&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
                echo &amp;quot;Cancelled.&amp;quot;;exit 0&lt;br /&gt;
        fi&lt;br /&gt;
;;&lt;br /&gt;
&amp;quot;stop&amp;quot;|&amp;quot;stopvm&amp;quot;)&lt;br /&gt;
        checkvm &amp;quot;$2&amp;quot;&lt;br /&gt;
        echo -n &amp;quot;Are you sure you want to gracefully shutdown VM: \&amp;quot;$2\&amp;quot; [y/N]? &amp;quot;;read ans&lt;br /&gt;
        shopt -s nocaseglob&lt;br /&gt;
        if [[ &amp;quot;$ans&amp;quot; == y* ]];then&lt;br /&gt;
                shopt -u nocaseglob&lt;br /&gt;
                func_stopvm &amp;quot;$2&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
                echo &amp;quot;Cancelled.&amp;quot;;exit 0&lt;br /&gt;
        fi&lt;br /&gt;
;;&lt;br /&gt;
&amp;quot;halt&amp;quot;|&amp;quot;hault&amp;quot;|&amp;quot;haltvm&amp;quot;|&amp;quot;haultvm&amp;quot;)&lt;br /&gt;
        checkvm &amp;quot;$2&amp;quot;&lt;br /&gt;
        echo -n &amp;quot;Are you sure you want to abruptly poweroff VM: \&amp;quot;$2\&amp;quot; [y/N]? &amp;quot;;read ans&lt;br /&gt;
        shopt -s nocaseglob&lt;br /&gt;
        if [[ &amp;quot;$ans&amp;quot; == y* ]];then&lt;br /&gt;
                shopt -u nocaseglob&lt;br /&gt;
                func_haultvm &amp;quot;$2&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
                echo &amp;quot;Cancelled.&amp;quot;;exit 0&lt;br /&gt;
        fi&lt;br /&gt;
;;&lt;br /&gt;
&amp;quot;-h&amp;quot;|&amp;quot;--help&amp;quot;)&lt;br /&gt;
        echo &amp;quot;Usage: vbox-command.sh [-h|--help] list|listall|start|stop|halt VMNAME&amp;quot;&lt;br /&gt;
        exit 0&lt;br /&gt;
;;&lt;br /&gt;
*)&lt;br /&gt;
        echo &amp;quot;Error: No valid command given.&amp;quot;&lt;br /&gt;
        echo &amp;quot;Usage: vbox-command.sh [-h|--help] list|listall|start|stop|halt VMNAME&amp;quot;&lt;br /&gt;
        exit 1&lt;br /&gt;
;;&lt;br /&gt;
esac&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
checkvm() {&lt;br /&gt;
if [ -z &amp;quot;`VBoxManage list vms|grep  \&amp;quot;$1\&amp;quot;`&amp;quot; ];then&lt;br /&gt;
        echo &amp;quot;Error: $1: No such VM.&amp;quot;&lt;br /&gt;
        exit 1&lt;br /&gt;
fi&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
func_startvm() {&lt;br /&gt;
VBoxManage startvm &amp;quot;$1&amp;quot; --type headless&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
func_stopvm() {&lt;br /&gt;
VBoxManage controlvm &amp;quot;$1&amp;quot; acpipowerbutton &amp;amp;&amp;amp; echo &amp;quot;ACPI signal sent.&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
func_haultvm() {&lt;br /&gt;
VBoxManage controlvm &amp;quot;$1&amp;quot; poweroff &amp;amp;&amp;amp; echo &amp;quot;Power off.&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
main $@&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I set the appropriate permissions:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
sudo chmod 755 /scripts/vbox-commands.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And I added some aliases to my &amp;lt;code&amp;gt;~/.bashrc&amp;lt;/code&amp;gt; file:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
# ALIASES&lt;br /&gt;
alias vbm='VBoxManage'&lt;br /&gt;
alias vb='/scripts/vbox-commands.sh'&lt;br /&gt;
alias vbl='/scripts/vbox-commands.sh list'&lt;br /&gt;
alias vbll='/scripts/vbox-commands.sh listall'&lt;br /&gt;
alias vbla='/scripts/vbox-commands.sh listall'&lt;br /&gt;
alias vbs='/scripts/vbox-commands.sh start'&lt;br /&gt;
alias vbx='/scripts/vbox-commands.sh stop'&lt;br /&gt;
alias vbh='/scripts/vbox-commands.sh halt'&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I then reload my bashrc:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
source ~/.bashrc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I should now be able to get the help dialog:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
# Get help dialog:&lt;br /&gt;
vb -h&lt;br /&gt;
&lt;br /&gt;
# Which prints:&lt;br /&gt;
#   Usage: vbox-command.sh [-h|--help] list|listall|start|stop|halt VMNAME&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The aliases are just shortcuts to each of these options, which can be run like:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
# To start VM (headless) with name &amp;quot;LDAPServer&amp;quot;&lt;br /&gt;
vbs LDAPServer&lt;br /&gt;
&lt;br /&gt;
# Which is an alias for 'vb start LDAPServer', or 'VBoxManage startvm LDAPServer --type headless'&lt;br /&gt;
# Another difference is that using 'vb' or 'vbs' asks for a yes/no confirmation.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;vbm&amp;lt;/code&amp;gt; alias is just a nice shortcut for &amp;lt;code&amp;gt;VBoxManage&amp;lt;/code&amp;gt; so you can still run some of the more complex commands. To get a full dialog of all VBoxManage parameters:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
vbm|less&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I'm very glad I made this, so I thought other people might enjoy it.&lt;/div&gt;</summary>
		<author><name>Beard</name></author>	</entry>

	</feed>