Domanda

I'm trying to get Middleman set up to run in Vagrant, so that all I have to do is run vagrant up and everything will be good to go. At the moment, I simply have Vagrant running middleman server as part of the provisioning steps, which actually is working, but the provisioning never really finishes then (after running vagrant up I don't get returned to the command line). Is there any way I can run Middleman so that this doesn't happen? I really just want to be able to daemonize Middleman or run it in the background or something, is this possible?

È stato utile?

Soluzione

The easiest is just to detach the process into background, with something like:

config.vm.provision "shell",
  inline: "nohup middleman server >> /vagrant/middleman.log 2>&1 &"

If you want to run it as the SSH user ("vagrant" by default) instead of root, add privileged: false option. For stopping the process you have to kill it or run vagrant halt/destroy.

More complete daemon setups you could take a look at for example runit.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top