Code Monkey home page Code Monkey logo

foreverb's People

Contributors

adamcrown avatar andyt avatar daddye avatar kostya avatar mzyy94 avatar pyromaniac avatar sadfuzzy avatar tribalvibes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

foreverb's Issues

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

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.

problem with capistrano

hi,
try to deploy an application with foreverrb with capistrano, at each deploy is created a new folder release.
Foreverb store the path to daemon with complete path to release instead of use link to symlink to current.

Is possible to write the path in file .foreverb with current instead of the full path to release?

Running live with log output to stdout

Is there a way to run the daemon in live mode with log output going to stdout instead of to the log file? That would be much easier to manage than start + tail.

Thanks

Start simple .rb file as a daemon?

Forver on node can start normal .js files. Does foreverb have diffrent view on that usage? It would be lovely to just use foreverb start app.rb, or at least foreverb daemonize app.rb && forever start app.rb?

Truncating logfile is difficult

I don't know if that's an issue but I noticed that truncating the logfile (the redirected STDOUT) doesn't work, at least the way expected. When doing

echo '' > out.log
ls -l out.log

ls still shows the old filesize. df shows the diskspace being freed. The logfile contains somehow invisible characters. It seems the open file should be rewinded or seek the beginning again. I work around this with this code at the moment:

Signal.trap('USR2'){ STDOUT.truncate 0 ; STDOUT.rewind }

To reproduce see https://gist.github.com/1564418

no pid-file created

No pid-file is created on startup. I guess line 24 should be:

File.open(pid, "w") { |f| f.write(Process.pid.to_s) } if pid

WARN: Unresolved specs during Gem::Specification.reset:

code:

require 'forever'

RAILS_ROOT = File.expand_path("..", File.dirname(__FILE__))

Forever.run :fork => true do
  before :each do
    require RAILS_ROOT + '/config/boot' # here the rails/padrino environment
  end

  every 2.seconds do
    p 'hello world'
  end
end

will appear the errors:

WARN: Unresolved specs during Gem::Specification.reset:
thor (>= 0.15.0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
"hello world"

undefined method sync

Am I missing something?

the code:

#!/usr/bin/env ruby

require 'forever'
Forever.run do

  on_ready do
    puts "foop"
    sleep 1
  end
end

the result:

[~/tmp]$ ./test.rb 
=> Found pid 34109...
=> Killing process 34109...
=> No such process
=> Process demonized with pid 34589
/Users/daniel/.rvm/gems/ruby-1.9.2-p180/gems/forever-0.0.8/lib/forever/base.rb:27:in `block in initialize': undefined method `sync=' for "/dev/null":String (NoMethodError)
        from /Users/daniel/.rvm/gems/ruby-1.9.2-p180/gems/forever-0.0.8/lib/forever/base.rb:18:in `fork'
        from /Users/daniel/.rvm/gems/ruby-1.9.2-p180/gems/forever-0.0.8/lib/forever/base.rb:18:in `initialize'
        from /Users/daniel/.rvm/gems/ruby-1.9.2-p180/gems/forever-0.0.8/lib/forever.rb:10:in `new'
        from /Users/daniel/.rvm/gems/ruby-1.9.2-p180/gems/forever-0.0.8/lib/forever.rb:10:in `run'
        from ./test.rb:4:in `<main>'
[daniel@naruto]--(22:50:26)

Create a rails example

I use forever js to run my node.js apps in the background as i dev them. I was hoping to use this for the same thing. Can you show an example of how you'd use this to run a rails webrick server (ideally with rails server -b 0.0.0.0).

Can't run a single script (YAML error)

Everytime i try to run the script i get the following error:

$ ./foreverb_test.rb 
/Users/Leandro/.rvm/gems/ruby-1.9.2-p180/gems/foreverb-0.2.6/lib/forever/base.rb:219:in `write_config!': undefined method `load_file' for YAML:Module (NoMethodError)
    from /Users/Leandro/.rvm/gems/ruby-1.9.2-p180/gems/foreverb-0.2.6/lib/forever/base.rb:17:in `initialize'
    from /Users/Leandro/.rvm/gems/ruby-1.9.2-p180/gems/foreverb-0.2.6/lib/forever.rb:20:in `new'
    from /Users/Leandro/.rvm/gems/ruby-1.9.2-p180/gems/foreverb-0.2.6/lib/forever.rb:20:in `run'
    from ./foreverb_test.rb:4:in `<main>'

Here is the script code:

#!/usr/bin/env ruby
require 'forever'

Forever.run do
  sleep 5
end

The latest gem has no files in it

Can you push a version which includes lib?

forever-0.1.4$ pwd
/Users/philc/.rvm/gems/ruby-1.8.7-p334@default/gems/forever-0.1.4
forever-0.1.4$ find .
.
./bin
./bin/forever
./forever.gemspec
./README.md

every block required in version 0.3.0.d

I'm using foreverb to run continues updates. In version 0.2.6 I could setup my script as follows:

Forever.run
  on_ready do
    while true
      do_some_action
    end
  end
end

In the latest version I get a no jobs assigned exception. I've worked around it by adding the following:

every 100.days do
  puts 'log this'
end

to make sure the jobs array receives a job. It's not really a bug per say, but it feel really dirty to set it up this way.

Not working with mri-2.2.0dev

I had to switch to mri-2.1.1, since whenever I run a script based to foreverb, it dies raising the following stack trace:

[miyuki] Pid not found, process seems doesn't exist!
[miyuki] Process daemonized with pid 44416 with thread and Forever v.0.3.2
/Users/giovanni/.rvm/gems/ruby-head/gems/foreverb-0.3.2/lib/forever/base.rb:76:in `trap': Invalid argument - SIGKILL (Errno::EINVAL)
    from /Users/giovanni/.rvm/gems/ruby-head/gems/foreverb-0.3.2/lib/forever/base.rb:76:in `block (2 levels) in initialize'
    from /Users/giovanni/.rvm/gems/ruby-head/gems/foreverb-0.3.2/lib/forever/base.rb:76:in `each'
    from /Users/giovanni/.rvm/gems/ruby-head/gems/foreverb-0.3.2/lib/forever/base.rb:76:in `block in initialize'
    from /Users/giovanni/.rvm/gems/ruby-head/gems/foreverb-0.3.2/lib/forever/base.rb:349:in `fork'
    from /Users/giovanni/.rvm/gems/ruby-head/gems/foreverb-0.3.2/lib/forever/base.rb:349:in `maybe_fork'
    from /Users/giovanni/.rvm/gems/ruby-head/gems/foreverb-0.3.2/lib/forever/base.rb:69:in `initialize'
    from /Users/giovanni/.rvm/gems/ruby-head/gems/foreverb-0.3.2/lib/forever.rb:18:in `new'
    from /Users/giovanni/.rvm/gems/ruby-head/gems/foreverb-0.3.2/lib/forever.rb:18:in `run'
    from /Users/giovanni/.rvm/gems/ruby-head/gems/miyuki-0.5.1/bin/miyuki:26:in `<top (required)>'
    from /Users/giovanni/.rvm/gems/ruby-head/bin/miyuki:23:in `load'
    from /Users/giovanni/.rvm/gems/ruby-head/bin/miyuki:23:in `<main>'
    from /Users/giovanni/.rvm/gems/ruby-head/bin/ruby_executable_hooks:15:in `eval'
    from /Users/giovanni/.rvm/gems/ruby-head/bin/ruby_executable_hooks:15:in `<main>'

Tests pass though.

list command is broken

 bin/foreverb list   
/u/apps/gsms/shared/bundle/ruby/1.9.1/gems/foreverb-0.3.0.f/bin/foreverb:22:in `read': can't convert nil into String (TypeError)
    from /u/apps/gsms/shared/bundle/ruby/1.9.1/gems/foreverb-0.3.0.f/bin/foreverb:22:in `block in list'
    from /u/apps/gsms/shared/bundle/ruby/1.9.1/gems/foreverb-0.3.0.f/bin/foreverb:20:in `each'
    from /u/apps/gsms/shared/bundle/ruby/1.9.1/gems/foreverb-0.3.0.f/bin/foreverb:20:in `list'
    from /u/apps/gsms/shared/bundle/ruby/1.9.1/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from /u/apps/gsms/shared/bundle/ruby/1.9.1/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from /u/apps/gsms/shared/bundle/ruby/1.9.1/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
    from /u/apps/gsms/shared/bundle/ruby/1.9.1/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
    from /u/apps/gsms/shared/bundle/ruby/1.9.1/gems/foreverb-0.3.0.f/bin/foreverb:170:in `<top (required)>'
    from bin/foreverb:16:in `load'
    from bin/foreverb:16:in `<main>'

Ubuntu Server 11.10

duplicate code in base.rb

in lib/forever/base.rb class Base is ducplicated twice.

Since Ruby has open classes, last definition of methods win.

Perhaps there was a merge error?

incompatible with padrino 0.10.7

Bundler could not find compatible versions for gem "thor":
In Gemfile:
foreverb (>= 0) x86-mingw32 depends on
thor (~> 0.14.6) x86-mingw32

padrino (= 0.10.7) x86-mingw32 depends on
thor (0.15.2)

How can this be fixed?

Configuration file format

When running foreverb list I'm been getting the following error:

Your config is empty, so no deamons was found.

I haven't been able to find any details on the ~/.foreverb file format. Is it documented anywhere?

Error on access enviroment

I can not load the environment and have access to models for example, I tried require '/config/boot', require_relative, require 'bundler/setup', does anyone know WHAT could it be?

Running live with log output to stdout

Is there a way to run the daemon in live mode with log output going to stdout instead of to the log file? That would be much easier to manage than start + tail.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.