god
god copied to clipboard
Missing event system in Ubuntu linux?
Here is my god:
God.watch do |w|
w.name = "taobao_order_god"
w.log = "/home/geek/emall/log/taobao_god.log"
w.pid_file = "/home/geek/emall/tmp/pids/taobao_god.pid"
w.behavior(:clean_pid_file)
w.start = "/home/geek/emall/script/rails runner TaobaoOrder.get_remote_orders"
w.interval = 6.seconds
w.start_if do |start|
start.condition(:process_running) do |c|
c.running = false
end
end
# determine the state on startup
w.transition(:init, { true => :up, false => :start }) do |on|
on.condition(:process_running) do |c|
c.running = true
end
end
# determine when process has finished starting
w.transition([:start, :restart], :up) do |on|
on.condition(:process_running) do |c|
c.running = true
end
# failsafe
on.condition(:tries) do |c|
c.times = 5
c.transition = :start
end
end
# start if process is not running
w.transition(:up, :start) do |on|
on.condition(:process_exits)
end
and the error: god -c config/taobao_order_god.god -D
I [2012-05-30 12:45:45] INFO: Loading config/taobao_order_god.god
I [2012-05-30 12:45:45] INFO: Syslog enabled.
I [2012-05-30 12:45:45] INFO: Using pid file directory: /home/geek/.god/pids
E [2012-05-30 12:45:45] ERROR: Condition 'God::Conditions::ProcessExits' requires an event system but none has been loaded
$which god
/opt/ruby-enterprise-1.8.7-2011.03/bin/god
$ god check
using event system: none
[fail] event system did not load
This is kind of buried on godrb.com documentation but the event system is only accessible through sudo access or as root. If you search the godrb.com page you'll see where this is pointed out. When you run the god -c config/taobao_order_god.god -D you're running god as the logged in user hence no event system. If you sudo that command it should work.
I have god running successfully using rvm and bundler, but recently I have tried to load a god config file into a running instance of god and received the following error (this occurs with many different god config files that used to work):
god load morethanpoints.god
Sending 'load' command with action 'leave'
Uncaught exception
wrong number of arguments (3 for 2)
(drbunix:///tmp/god.17165.sock) /home/hhwangbo/.rvm/gems/ruby-1.9.2-p290/gems/god-0.11.0/lib/god.rb:541:in running_load' (drbunix:///tmp/god.17165.sock) /home/hhwangbo/.rvm/gems/ruby-1.9.2-p290/gems/god-0.11.0/lib/god/socket.rb:58:in
method_missing'
(drbunix:///tmp/god.17165.sock) /home/hhwangbo/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1558:in perform_without_block' (drbunix:///tmp/god.17165.sock) /home/hhwangbo/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1518:in
perform'
(drbunix:///tmp/god.17165.sock) /home/hhwangbo/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1592:in block (2 levels) in main_loop' (drbunix:///tmp/god.17165.sock) /home/hhwangbo/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1588:in
loop'
(drbunix:///tmp/god.17165.sock) /home/hhwangbo/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1588:in block in main_loop' /home/hhwangbo/.rvm/gems/ruby-1.9.2-p290/gems/god-0.12.1/lib/god/cli/command.rb:58:in
load_command'
/home/hhwangbo/.rvm/gems/ruby-1.9.2-p290/gems/god-0.12.1/lib/god/cli/command.rb:30:in dispatch' /home/hhwangbo/.rvm/gems/ruby-1.9.2-p290/gems/god-0.12.1/lib/god/cli/command.rb:10:in
initialize'
/home/hhwangbo/.rvm/gems/ruby-1.9.2-p290/gems/god-0.12.1/bin/god:119:in new' /home/hhwangbo/.rvm/gems/ruby-1.9.2-p290/gems/god-0.12.1/bin/god:119:in
<top (required)>'
/home/hhwangbo/.rvm/gems/ruby-1.9.2-p290/bin/god:19:in load' /home/hhwangbo/.rvm/gems/ruby-1.9.2-p290/bin/god:19:in
Here's my ubuntu info: lsb_release -a Distributor ID: Ubuntu Description: Ubuntu 10.04.4 LTS Release: 10.04 Codename: lucid
god -v Version 0.12.1
ruby -v ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
rvm -v rvm 1.8.4 by Wayne E. Seguin ([email protected]) [https://rvm.beginrescueend.com/]
Any ideas would be greatly appreciated. Again, god is currently running with some other jobs. I'm afraid to stop it and not be able to start it again. Any ideas why the god config is not loading? Why is it assuming I am passing along a leave parameter when it's clearly optional and I'm not passing it along?
Thanks, Henry
@henry74,Same issue with your, how did you resolve this problem, thanks
@henry74 - the same here, how you solved it?
I haven't solved it but I recently tried to load another god file and I didn't get any errors...
I fixed it. I got this error when I tried to push new config to god from RVM and system god was running (socket was in use)
I know this is a bit old but it still shows as one of the first for a search on this subject.
After some digging it looks like godrb requires gcc in order to compile the netlink binaries. You can check if this failed here: /usr/lib/ruby/gems/1.8/gems/god-0.13.4/ext/god
more mkmf.log have_header: checking for linux/netlink.h... -------------------- no
"gcc -E -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-pr otector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing -fPIC conftest.c -o conftest.i" checked program was: /* begin / 1: #include <linux/netlink.h> / end */
have_header: checking for linux/connector.h... -------------------- no
"gcc -E -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-pr otector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing -fPIC conftest.c -o conftest.i" checked program was: /* begin / 1: #include <linux/connector.h> / end */
In my case I didn't have gcc installed, after installing gcc and re-installing god you get the following:
more mkmf.log have_header: checking for linux/netlink.h... -------------------- yes
"gcc -E -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-pr otector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing -fPIC conftest.c -o conftest.i" checked program was: /* begin / 1: #include <linux/netlink.h> / end */
have_header: checking for linux/connector.h... -------------------- yes
"gcc -E -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-pr otector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing -fPIC conftest.c -o conftest.i" checked program was: /* begin / 1: #include <linux/connector.h> / end */
have_header: checking for linux/cn_proc.h... -------------------- yes
"gcc -E -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-pr otector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing -fPIC conftest.c -o conftest.i" checked program was: /* begin / 1: #include <linux/cn_proc.h> / end */
Hope this helps.
@geekontheway @henry74 @shaun-rutherford Use
sudo god -c config/taobao_order_god.god -D
resolved this issue.