Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I want Vagrant to start the Play server in the /vagrant/ folder every time I do vagrant up. Putting @reboot on the crontab doesn't work because the script runs before the /vagrant/ folder is connected.

share|improve this question

2 Answers 2

up vote 9 down vote accepted

Instead of using crontab, have you tried using Upstart?

Vagrant emits a "vagrant-mounted" event when the shared folder is mounted, so you could create an upstart conf file, say /etc/init/play.conf, to run when that event is emitted:

description "Play server"
start on vagrant-mounted

pre-start script
    [ "$MOUNTPOINT" == "/vagrant" ] || stop
end script

... rest of config file for starting Play server ...
share|improve this answer
Thanks! Not sure why I got the error /bin/sh: 1: [: =: unexpected operator, so I just uncommented that line. –  wrongusername Jan 17 '14 at 17:13
Oops! I edited the post so that the syntax is correct. –  billyw Jan 17 '14 at 17:30
Just the solution for my problem, Thanks –  davidselo Apr 24 '14 at 7:16

I found using a seperate vagrant provisioner with the option run : "always" a lot easier, eg:

config.vm.provision :shell, path: "yourStartUp.sh", run: "always", privileged: false

See https://docs.vagrantup.com/v2/provisioning/shell.html for full doc.

share|improve this answer
Simple solution requiring no plugins. Thanks! –  Martin Carney Jan 21 at 18:49
This is by far the best solution! Thank you! –  wulftone May 1 at 23:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.