Run rb-fsevent in the background

93 views Asked by At

I'm trying to use the Daemons gem to daemonize a process in the background.This process just checks for any change in a directory and reports it. I've used the Daemons gem before and never really ran into any problems, however when I mix it with the rb-fsevent directory monitoring, something seems to go wrong.

Here's the ruby code that monitors the directory change,

require 'rb-fsevent'
require 'rubygems'

notifier = FSEvent.new
notifier.watch "/Test/NewFolder" do |directories|
  puts "Detected change inside: #{directories.inspect}"
end
notifier.run

And here's how I'm calling the ruby file,

require 'rubygems'
require 'daemons'

Daemons.run('folder_watcher_mac.rb')

When I run "ruby start_watcher.rb start" nothing is happening. Is this the right way to daemonize the rb-fsevent?

0

There are 0 answers