Ruby 进程管理框架:God
cm54
10年前
God 是一个使用 Ruby 写成的用于监视任务运行状态的可扩展框架,它的配置脚本同样采用 Ruby 来编写。因此,比起它的前辈 Monit,God 更为简单,灵活且易于扩展(尤其对于 Ruby 使用者),你可以很轻易的添加一些自定义规则。
示例:
# Events I [2011-12-10 15:24:34] INFO: Loading simple.god I [2011-12-10 15:24:34] INFO: Syslog enabled. I [2011-12-10 15:24:34] INFO: Using pid file directory: /Users/tom/.god/pids I [2011-12-10 15:24:34] INFO: Started on drbunix:///tmp/god.17165.sock I [2011-12-10 15:24:34] INFO: simple move 'unmonitored' to 'init' I [2011-12-10 15:24:34] INFO: simple moved 'unmonitored' to 'init' I [2011-12-10 15:24:34] INFO: simple [trigger] process is not running (ProcessRunning) I [2011-12-10 15:24:34] INFO: simple move 'init' to 'start' I [2011-12-10 15:24:34] INFO: simple start: ruby /Users/tom/dev/mojombo/god/simple.rb I [2011-12-10 15:24:34] INFO: simple moved 'init' to 'start' I [2011-12-10 15:24:34] INFO: simple [trigger] process is running (ProcessRunning) I [2011-12-10 15:24:34] INFO: simple move 'start' to 'up' I [2011-12-10 15:24:34] INFO: simple registered 'proc_exit' event for pid 23298 I [2011-12-10 15:24:34] INFO: simple moved 'start' to 'up' # Polls I [2011-12-07 09:40:18] INFO: Loading simple.god I [2011-12-07 09:40:18] INFO: Syslog enabled. I [2011-12-07 09:40:18] INFO: Using pid file directory: /Users/tom/.god/pids I [2011-12-07 09:40:18] INFO: Started on drbunix:///tmp/god.17165.sock I [2011-12-07 09:40:18] INFO: simple move 'unmonitored' to 'up' I [2011-12-07 09:40:18] INFO: simple moved 'unmonitored' to 'up' I [2011-12-07 09:40:18] INFO: simple [trigger] process is not running (ProcessRunning) I [2011-12-07 09:40:18] INFO: simple move 'up' to 'start' I [2011-12-07 09:40:18] INFO: simple start: ruby /Users/tom/dev/mojombo/god/simple.rb I [2011-12-07 09:40:19] INFO: simple moved 'up' to 'up' I [2011-12-07 09:40:19] INFO: simple [ok] process is running (ProcessRunning) I [2011-12-07 09:40:24] INFO: simple [ok] process is running (ProcessRunning) I [2011-12-07 09:40:29] INFO: simple [ok] process is running (ProcessRunning)