Skip to content

Instantly share code, notes, and snippets.

@bubba-h57
Created November 25, 2014 13:35
Show Gist options
  • Save bubba-h57/a1ce78dcca4337cb1b73 to your computer and use it in GitHub Desktop.
Save bubba-h57/a1ce78dcca4337cb1b73 to your computer and use it in GitHub Desktop.
There are a number of scenarios wherein apache will fail to start on vagrant up because it relies on filesystems that are not yet mounted when it attempts to start. This upstart script solves the challenge by waiting for the vagrant-mounted event, and then starting up the service.
# vagrant-apache - manages our apache service, and starts it once vagrant is ready
#
# Ubuntu Installation:
# /usr/bin/sudo /bin/cp ./vagrant-apache.conf /etc/init/vagrant-apache.conf
# /usr/bin/sudo /bin/chmod 644 /etc/init/vagrant-apache.conf
# /usr/bin/sudo /bin/ln /lib/init/upstart-job /etc/init.d/vagrant-apache
description "Manage Apache in Vagrant"
author "Bubba Hines <rob@stechstudio.com>"
start on vagrant-mounted
exec sudo service apache2 start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment