monitで自動起動

やてみた。

インストール

yum install monit --enablerepo=dag

設定
/etc/monit.conf

 # これだけは設定しないと起動できない
 set daemon  120

設定2

vi /etc/monit.d/gearmand

check process gearmand with pidfile /var/run/gearman.pid
    start program = "/usr/bin/gearmand -d --pidfile /var/run/gearman.pid"
    stop program  = "/usr/bin/killall gearmand"
    if failed port 7003 then restart
    if 5 restarts within 5 cycles then timeout

起動

service monit start

gearmandを落として2分ぐらい立つと再起動された。

TODO

gearman-workerの設定ファイルはどう書けば良いんだ。