2012-08-23 24 views
3

这可能是一个相当新手修复,所以提前致歉。上帝(红宝石进程管理器)不断重启我的进程

我有一个简单的过程,我想控制上帝。这个阶段的过程基本上只是loop do; sleep 1; end。配置文件是最低限度:

God.watch do |w| 
    w.name = "punter" 
    w.start = "bundle exec rails runner ./script/fetcher_daemon.rb" 
    w.keepalive 
end 

该进程不断重新开始,并且pid文件不断重置。这就像上帝可以开始一切正常,然后不认识到该进程正在运行并重新启动它。见下面的日志文件:

我可以从命令行运行bundle exec rails runner ./script/fetcher_daemon.rb,它运行良好。

我的设置是Mint Linux,我使用rvm。

I [2012-08-23 19:33:42] INFO: Loading ./script/punter.god 
I [2012-08-23 19:33:42] INFO: Syslog enabled. 
I [2012-08-23 19:33:42] INFO: Using pid file directory: /home/matt/.god/pids 
I [2012-08-23 19:33:42] INFO: Started on drbunix:///tmp/god.17165.sock 
I [2012-08-23 19:33:42] INFO: punter move 'unmonitored' to 'up' 
D [2012-08-23 19:33:42] DEBUG: driver schedule #<God::Conditions::ProcessRunning:0x917d7d0> in 0 seconds 
I [2012-08-23 19:33:42] INFO: punter moved 'unmonitored' to 'up' 
I [2012-08-23 19:33:42] INFO: punter [trigger] process is not running (ProcessRunning) 
D [2012-08-23 19:33:42] DEBUG: punter ProcessRunning [true] {true=>:start} 
I [2012-08-23 19:33:42] INFO: punter move 'up' to 'start' 
I [2012-08-23 19:33:42] INFO: punter start: bundle exec rails runner ./script/fetcher_daemon.rb 
D [2012-08-23 19:33:42] DEBUG: driver schedule #<God::Conditions::ProcessRunning:0x917d7d0> in 0 seconds 
I [2012-08-23 19:33:42] INFO: punter moved 'up' to 'up' 
I [2012-08-23 19:33:42] INFO: punter [ok] process is running (ProcessRunning) 
D [2012-08-23 19:33:42] DEBUG: punter ProcessRunning [false] {true=>:start} 
D [2012-08-23 19:33:42] DEBUG: driver schedule #<God::Conditions::ProcessRunning:0x917d7d0> in 5 seconds 
I [2012-08-23 19:33:47] INFO: punter [trigger] process is not running (ProcessRunning) 
D [2012-08-23 19:33:47] DEBUG: punter ProcessRunning [true] {true=>:start} 
I [2012-08-23 19:33:47] INFO: punter move 'up' to 'start' 
I [2012-08-23 19:33:47] INFO: punter start: bundle exec rails runner ./script/fetcher_daemon.rb 
D [2012-08-23 19:33:48] DEBUG: driver schedule #<God::Conditions::ProcessRunning:0x917d7d0> in 0 seconds 
I [2012-08-23 19:33:48] INFO: punter moved 'up' to 'up' 
I [2012-08-23 19:33:48] INFO: punter [ok] process is running (ProcessRunning) 
D [2012-08-23 19:33:48] DEBUG: punter ProcessRunning [false] {true=>:start} 
D [2012-08-23 19:33:48] DEBUG: driver schedule #<God::Conditions::ProcessRunning:0x917d7d0> in 5 seconds 
+0

更新:这似乎与rvm有关。事实上,rvm上的好人已经提供了关于如何在rvm下使用god的信息。 https://rvm.io/integration/god/不幸的是,按照这些说明并没有帮助我。当我运行'〜/ .rvm/bin/bootup_god -c script/punter.god -D'时,发生同样的事情 – mattfitzgerald

回答

1

您需要在您的god文件中使用绝对路径。所以这里是

God.watch do |w| 
    w.name = "punter" 
    w.start = "bundle exec rails runner /home/matt/code/punter/script/fetcher_daemon.rb" # <- abs path 
    w.keepalive 
end