| <% | |
| # NOTE: this only works with cake shells as the cake bin and other params are hard-coded in the cmd: | |
| # we have to wrap in a shell so we can capture STDOUT because monit forks and disconnects the outputs. | |
| wrapped_cmd = "/bin/bash -c 'echo $$ > #{@pidfile}; #{@cake_bin} #{@cmd} -app #{@app_root} >> #{@logfile} 2>&1'" | |
| -%> | |
| check process <%= @monit_name %> | |
| with pidfile <%= @pidfile %> | |
| start program = "<%= wrapped_cmd %>" | |
| as uid www-data and gid www-data | |
| stop program = "/bin/kill -9 `cat <%= @pidfile %>` && rm -f <%= @pidfile %>" | |
| with timeout <%= @stop_timeout %> seconds | |
| if totalmem > 128 MB for 5 cycles then alert | |
| if cpu > 75% for 5 cycles then alert | |
| if 5 restarts within 5 cycles then timeout | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment