如何用上帝监控和重启两个ruby脚本?

时间:2016-01-15 23:00:35

标签: ruby god

我已经能够为单个ruby脚本运行单个神文件:

God.watch do |w|
  w.name = "twilio"
  w.start = "ruby ~/code/site/iron.io/twilio-listen.rb"
  w.keepalive
end

但我有两个剧本,想让上帝同时观看它们(twilio-listen.rb和slack-listen.rb)

我该怎么做?

1 个答案:

答案 0 :(得分:1)

您应该能够在同一个God配置文件中为两者指定监视。如果您需要一起停止或重新启动它们,您可能还想添加一个名为listeners的组。如,

God.watch do |w|
  w.name = "twilio"
  w.group = "listeners"
  w.start = "ruby ~/code/site/iron.io/twilio-listen.rb"
  w.keepalive
end

God.watch do |w|
  w.name = "slack"
  w.group = "listeners"
  w.start = "ruby ~/code/site/iron.io/slack-listen.rb"
  w.keepalive
end