以下の内容はhttps://hogem.hatenablog.com/entry/20111112/1321098751より取得しました。


monit をupstart形式でrespawn起動させる

今まではinittab(SysVinit)に

mo:2345:respawn:/usr/local/bin/monit -Ic /etc/monit/monitrc

と書いてた(monitの公式にsampleが載ってる)んだけど、upstartはどうすんだろーう。と/etc/init/ 以下眺めてたらtty1(tty1.conf)の起動がstart on runlevel でrespawnしてるので、同じように書いたら動きました。

  • /etc/init/monit.conf
start on runlevel [2345]
stop on runlevel [!2345]

respawn
exec /usr/local/bin/monit -Ic /etc/monit/monitrc
$ sudo monit -t
Control file syntax OK
$ initctl status monit
monit stop/waiting
$ sudo initctl start monit
monit start/running, process 27728
$ initctl status monit
monit start/running, process 27728
$ sudo kill 27728
$ initctl status monit
monit start/running, process 27927

おおー、無事initctlで起動できて、killで殺しても復活してきたわ。

ref.

追記

monit-5.3.1 のsource見たら、contrib/monit.upstart にsampleが書いてたわ。

description "Monit service manager"

limit core unlimited unlimited

start on runlevel [2345]
stop on runlevel [!2345]

expect daemon
respawn

exec /usr/local/bin/monit -c /etc/monitrc

pre-stop exec /usr/local/bin/monit -c /etc/monitrc quit



以上の内容はhttps://hogem.hatenablog.com/entry/20111112/1321098751より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14