mitchellh/vagrant — pull request #576 by paulsmith (2011-11-30 14:24:04+00:00)
Title: Emit event for Upstart configs when shared folders are mounted

A common use of Vagrant's shared folders is to mount the working directory of the repo in the guest VM, where an application-specific web server can be launched. That allows developers to edit files locally on their host OS with their preferred tools, while the guest VM picks up code changes and auto-reloads the web server (eg., WEBrick and Mongrel for Ruby/Rails, Django's runserver).

Currently, this web server needs to be manually started by the user by SSH'ing in to the guest VM. It's possible to use a Upstart config to automatically start it when the VM boots or restarts (`vagrant reload`). However, the problem is that the shared folders are mounted very late in the boot process, after Upstart has run -- when the app web server attempts to run, it (typically) crashes because the path to the application's source code does not (yet) exist. Additionally, there is no way to notify the Upstart config for the web server that the path is now available.

This pull request simply emits an event on the guest VM using Upstart's `initctl` command after the shared folders have been mounted. A user can then write an Upstart config that registers an interest in this event, for example, by starting when the event is emitted (eg., `start on `).

The particular event name is just a symbol, it can be named anything so long as it is reasonably unique.