Take the 2-minute tour ×
Server Fault is a question and answer site for professional 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

1 Answer 1

up vote 7 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 at 17:13
    
Oops! I edited the post so that the syntax is correct. –  billyw Jan 17 at 17:30
    
Just the solution for my problem, Thanks –  davidselo Apr 24 at 7:16

Your Answer

 
discard

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.