You might have the same problem I had with using daemonize (might be with anything else, too): File.dirname(__FILE__) doesn’t work after right daemonizing.
Although I haven’t been able to catch the exception message or whatever info, I’m almost sure the problem is that daemonize does a Dir.chdir “/”. Try run this script from a file in any directory and it will always print “/”:
Dir.chdir "/"
puts File.expand_path(File.dirname(__FILE__))
Anyway, save the path to the directory before daemonizing and you’ll be fine.