Joeri Timmermans

IT Consultancy
Kruisstraat 30 bus 002, 3120 Tremelo
+32 477 39 91 34
BE 0679.905.761

Run a command on every "vagrant up"

Wednesday January 7, 2015 - Permalink - Tags: vagrant, service, provisioning, ubuntu

So today I had this issue where a service was dependant on a folder which gets mounted after the box is started. So the service failed since it got started with the box and before the mount.

One thing that is done after the mounting has complete is your provisioning. So what I did was the following:

config.vm.provision :shell, :inline => "service supervisor stop && service supervisor start", run: "always"

A simple but effective way to restart a service when your box is fully functional, by adding run: "Always" every time your box is started this will run.

More info: https://docs.vagrantup.com/v2/provisioning/basic_usage.html

comments powered by Disqus