Detect if application was started as HTTP server or not (rake task, rconsole etc)

前端 未结 6 1958
隐瞒了意图╮
隐瞒了意图╮ 2020-12-09 19:47

I\'m using EventMachine and Monetarily to start e TCP server along with my rails application. This is started from config/initializers/momentarily.rb.

6条回答
  •  不思量自难忘°
    2020-12-09 20:18

    After your application launches, you could have it shell out to check ps. If ps shows that the HTTP server is running and the running HTTP server has the same pid as your application (check the pid by inspecting $$), then you could launch the TCP server.

提交回复
热议问题