Use preforker(ruby gem) with supervisor

Posted by user1548832 on Super User See other posts from Super User or by user1548832
Published on 2012-12-14T10:16:15Z Indexed on 2012/12/14 11:07 UTC
Read the original article Hit count: 200

Filed under:
|
|

I also asked same question on stackoverflow.com

http://stackoverflow.com/questions/13871169/use-preforkerruby-gem-with-supervisor

But, superuser.com might much help to me. Can anyone amswer this?


I want to run a server program using preforker ruby gem with supervisor. But error has occured.

I wrote a following test program using preforker.

#!/usr/bin/env ruby

require 'rubygems'
require 'preforker'

Preforker.new(:app_name => 'test-preforker', :timeout => 60, :workers => 1) do |master|
  while master.wants_me_alive? do
    puts "hello"
    sleep 10
  end 
end.run

And a following supervisor config.

[program:test-preforker]
command=/home/tkono/tmp/test-preforker.rb
stdout_logfile_maxbytes=1MB
stderr_logfile_maxbytes=1MB
stdout_logfile=/var/log/%(program_name)s.log
stderr_logfile=/var/log/%(program_name)s.log
autorestart=true

Then, reload supervisor.

# supervisorctl reload
Restarted supervisord

Here is the log file of supervisor.

2012-12-13 17:50:47,161 CRIT Supervisor running as root (no user in config file)
2012-12-13 17:50:47,163 WARN Included extra file "/etc/supervisor.d/test-preforker.ini" during parsing
2012-12-13 17:50:47,209 INFO RPC interface 'supervisor' initialized
2012-12-13 17:50:47,213 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2012-12-13 17:50:47,215 INFO supervisord started with pid 12437
2012-12-13 17:50:48,231 INFO spawned: 'test-preforker' with pid 12440
2012-12-13 17:50:48,233 INFO exited: test-preforker (exit status 1; not expected)
2012-12-13 17:50:49,248 INFO spawned: 'test-preforker' with pid 12441
2012-12-13 17:50:49,261 INFO exited: test-preforker (exit status 1; not expected)
2012-12-13 17:50:51,267 INFO spawned: 'test-preforker' with pid 12442
2012-12-13 17:50:51,284 INFO exited: test-preforker (exit status 1; not expected)
2012-12-13 17:50:54,305 INFO spawned: 'test-preforker' with pid 12443
2012-12-13 17:50:54,308 INFO exited: test-preforker (exit status 1; not expected)
2012-12-13 17:50:55,311 INFO gave up: test-preforker entered FATAL state, too many start retries too quickly

Please tell me what is wrong? A program using preforker cannot run with supervisor?


preforker https://github.com/dcadenas/preforker

supervisor http://supervisord.org/index.html

© Super User or respective owner

Related posts about linux

Related posts about ruby