foreverb icon indicating copy to clipboard operation
foreverb copied to clipboard

tail: bar.log: No such file or directory and

Open JeanOsorio opened this issue 9 years ago • 1 comments

I'm usign foreverb to run two daemon:

generate_roster_kids.rb

#!/usr/bin/ruby
require 'rubygems' unless defined?(Gem)
require 'forever'
require 'redis'

Forever.run do
  REDIS = Redis.new()

  log  "bar.log" # Default: File.expand_path(dir, '/log/[file_name].log')


  every 2.seconds do


    REDIS.SUNIONSTORE :busy, REDIS.keys('Busy:*') rescue REDIS.SUNIONSTORE :busy, nil
    REDIS.EXPIRE :busy, 3

    REDIS.SUNIONSTORE :online, REDIS.keys('Online:*') rescue REDIS.SUNIONSTORE :online, nil
    REDIS.EXPIRE :online, 3
  end

end

booking_release.rb

#!/usr/bin/ruby
require 'rubygems' unless defined?(Gem)
require 'forever'
require File.expand_path("../../../config/environment", __FILE__)

Forever.run do
  every 2.seconds do
    @booking = Booking.where(booking_available: false, :created_at.lt => DateTime.now.to_datetime.in_time_zone("Madrid") - 10.minutes).to_a
    @booking.each do |book|
      if book.Ds_Response.nil?
        book.booking_available = true
        book.save!
        puts "update #{book.id}"
      end
    end
    puts "#{@booking.count}"
  end
end

Those file are in my blabloo/script/user folder, as you can see the generate_roster_kids log on a file "bar.log", I have the log file on blabloo/script/log/bar.log but when I try to use the command foreverb tail generate_roster_kids or foreverb tail booking_release I always get:

tail: bar.log: No such file or directory

Also, a week ago I have a third daemon with the name of "classes_notification.rb" and now when I try to run foreverb start --all I get the following:

Do you want really start /Users/jeanosorio/repos/blabloo/script/user/generate_roster_kids.rb? Do you want really start /Users/jeanosorio/repos/blabloo/script/user/classes_notification.rb? Do you want really start /Users/jeanosorio/repos/blabloo/script/user/booking_release.rb?

but the classes_notification file does not exist. What I'm doing wrong???, how can I stop foreverb to ask me for the classes_notification daemon and what happen with the log file.

Thanks in advance for your help.

JeanOsorio avatar Nov 03 '14 10:11 JeanOsorio

can you post the classes_notification.rb ?

Also, require File.expand_path("../../../config/environment", __FILE__) is this rails? Is one of recent versions that uses bundler? If so:

#!/usr/bin/ruby
require File.expand_path("../../../config/environment", __FILE__)

Then just add forever to the Gemfile

DAddYE avatar Nov 03 '14 19:11 DAddYE