From 81e61b212b83573d644589fd6c9560c51e03be0c Mon Sep 17 00:00:00 2001 From: Fred Turkington Date: Thu, 19 Dec 2019 22:16:50 +0000 Subject: [PATCH 1/3] =?UTF-8?q?Update=20Post=20=E2=80=9C2014-12-10-keeping?= =?UTF-8?q?-virtualbox-and-vagrant-boxes-alive-through-reboots=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...grant-boxes-alive-through-reboots.markdown | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/_posts/2014-12-10-keeping-virtualbox-and-vagrant-boxes-alive-through-reboots.markdown b/_posts/2014-12-10-keeping-virtualbox-and-vagrant-boxes-alive-through-reboots.markdown index 2298331..a8b873e 100644 --- a/_posts/2014-12-10-keeping-virtualbox-and-vagrant-boxes-alive-through-reboots.markdown +++ b/_posts/2014-12-10-keeping-virtualbox-and-vagrant-boxes-alive-through-reboots.markdown @@ -1,51 +1,50 @@ --- title: Keeping VirtualBox and Vagrant Boxes Alive Through Reboots -date: 2014-12-10 18:50:55 Z layout: post -comments: true +date: 2014-12-10T18:50:55.000Z +published: true --- - I recently switched from a dedicated Windows 7 PC for my home server to a Mac Mini, mostly for the better electricity consumption and the fact the the PC was having nightly bluescreen crashes and restarting. I have always been a fan of RDP, and my office uses PCs - so to keep the convenient RDP access to home, I installed [VirtualBox](www.virtualbox.org) and created a Windows VM. This has a bridged network adapter, so it just looks like another computer on my home network. However, when Mac OS restarts, or after a power failure, the virtual machine is powered off. This won't do. -### Daemons in Mac OS ### +### Daemons in Mac OS Mac OS has the usual suspects like cron, but has a neat daemon launching system, appropriately called [launchd](https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html), introduced in 10.4. Launchd works by "loading" (think of it like a soft-install) objects called '''plist'''. Plist is a serialized object format like JSON or XML that tells launchd the properties of how to execute a particular daemon. -If you want to play with creating your own plists, head over to [http://launched.zerowidth.com](http://launched.zerowidth.com), where Nathan Witmer has created a plist generator. +If you want to play with creating your own plists, head over to , where Nathan Witmer has created a plist generator. -### Automatic Tasks in VirtualBox ### +### Automatic Tasks in VirtualBox VirtualBox comes with a command-line interface to automate tasks on VMs. My need is simple - just boot the box: -{% highlight bash %} -VBoxHeadless -s Windows -v on +{% highlight bash %} VBoxHeadless -s Windows -v on {% endhighlight %} This follows the syntax for VBoxHeadless: -{% highlight text %} - -s, -startvm, --startvm Start given VM (required argument) +{% highlight text %} -s, -startvm, --startvm Start given VM (required argument) -v, -vrde, --vrde on|off|config Enable (default) or disable the VRDE server or don't change the setting {% endhighlight %} VRDE is the Virtual Remote Desktop extension, which allows RDP out of the box through a special Oracle tool. -### Booting my VM at Login ### +### Booting my VM at Login launchd has multiple "runlevels" - there are System level daemons, and daemons for whenever a given user logs in. User daemons are stored at ~/Library/LaunchAgents/. With the help of the launched tool, I made a plist for my command: - {% highlight xml %} + + + KeepAlive @@ -82,11 +81,8 @@ Notable options in here: This xml is saved into a file in /Library/LaunchAgents. Navigate to that directory, and execute -{% highlight text %} -launchctl load -{% endhighlight %} +{% highlight text %} launchctl load {% endhighlight %} *launchctl* is the program that Mac OS uses to control launchd processes. Once the plist has been loaded, it should persist after reboot. A similar plist can be used for the command 'vagrant up' to launch vagrant vms. - From 598f98dbf6dee2cd05fb509b6433ae710659ac7b Mon Sep 17 00:00:00 2001 From: Fred Turkington Date: Thu, 19 Dec 2019 22:17:07 +0000 Subject: [PATCH 2/3] =?UTF-8?q?Update=20Post=20=E2=80=9C2014-12-10-keeping?= =?UTF-8?q?-virtualbox-and-vagrant-boxes-alive-through-reboots=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tualbox-and-vagrant-boxes-alive-through-reboots.markdown | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/_posts/2014-12-10-keeping-virtualbox-and-vagrant-boxes-alive-through-reboots.markdown b/_posts/2014-12-10-keeping-virtualbox-and-vagrant-boxes-alive-through-reboots.markdown index a8b873e..f9a3f0e 100644 --- a/_posts/2014-12-10-keeping-virtualbox-and-vagrant-boxes-alive-through-reboots.markdown +++ b/_posts/2014-12-10-keeping-virtualbox-and-vagrant-boxes-alive-through-reboots.markdown @@ -22,13 +22,11 @@ If you want to play with creating your own plists, head over to Start given VM (required argument) - -v, -vrde, --vrde on|off|config Enable (default) or disable the VRDE server or don't change the setting +{% highlight text %} -s, -startvm, --startvm Start given VM (required argument) -v, -vrde, --vrde on|off|config Enable (default) or disable the VRDE server or don't change the setting {% endhighlight %} VRDE is the Virtual Remote Desktop extension, which allows RDP out of the box through a special Oracle tool. From 18789ef9047db8ed2c3bb0471624068a10edd4cd Mon Sep 17 00:00:00 2001 From: Fred Turkington Date: Thu, 19 Dec 2019 22:18:03 +0000 Subject: [PATCH 3/3] =?UTF-8?q?Update=20Post=20=E2=80=9C2014-12-10-keeping?= =?UTF-8?q?-virtualbox-and-vagrant-boxes-alive-through-reboots=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...virtualbox-and-vagrant-boxes-alive-through-reboots.markdown | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/_posts/2014-12-10-keeping-virtualbox-and-vagrant-boxes-alive-through-reboots.markdown b/_posts/2014-12-10-keeping-virtualbox-and-vagrant-boxes-alive-through-reboots.markdown index f9a3f0e..503269a 100644 --- a/_posts/2014-12-10-keeping-virtualbox-and-vagrant-boxes-alive-through-reboots.markdown +++ b/_posts/2014-12-10-keeping-virtualbox-and-vagrant-boxes-alive-through-reboots.markdown @@ -26,8 +26,7 @@ VirtualBox comes with a command-line interface to automate tasks on VMs. My need This follows the syntax for VBoxHeadless: -{% highlight text %} -s, -startvm, --startvm Start given VM (required argument) -v, -vrde, --vrde on|off|config Enable (default) or disable the VRDE server or don't change the setting -{% endhighlight %} +{% highlight text %} -s, -startvm, --startvm Start given VM (required argument) -v, -vrde, --vrde on|off|config Enable (default) or disable the VRDE server or don't change the setting {% endhighlight %} VRDE is the Virtual Remote Desktop extension, which allows RDP out of the box through a special Oracle tool.