Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to auto run vagrant fsnotify?

I am developing angular4 app using vagrant. I have installed vagrant-fsnotify plugin in order to notify file system changes to trigger hot build. The problem I have is how to run automatically vagrant fsnotify when vagrant booted?

like image 379
gandra404 Avatar asked Oct 18 '22 15:10

gandra404


2 Answers

Maybe vagrant-trigger can help you run this command everytime you boot your vm. An example should be like:

Vagrant.configure("2") do |config|
    # Your existing Vagrant configuration
     ...

     # start fsnotify on host after the guest starts
     config.trigger.after :up do
         run "vagrant fsnotify"
     end
end
like image 75
alessandrocb Avatar answered Oct 21 '22 03:10

alessandrocb


Correct form of trigger statement is:

  # start fsnotify on host after the guest starts
  config.trigger.after :up do |trigger|
    trigger.run = {inline: "bash -c 'vagrant fsnotify > output.log 2>&1 &'"}
  end
like image 36
Віталій Боринський Avatar answered Oct 21 '22 05:10

Віталій Боринський