set daemon 120
set logfile /var/log/monit.log
set idfile /var/lib/monit/id
set statefile /var/lib/monit/state
set eventqueue
  basedir /var/lib/monit/events
  slots 100

check process puma
  with pidfile /var/run/puma.pid
  start program = "/usr/local/bundle/bin/puma --config /app/docker/puma_config.rb"
  stop program = "/usr/bin/pkill --pidfile /var/run/puma.pid"

check process memcache
  with pidfile /var/run/memcached.pid
  start program = "/etc/init.d/memcached start"
  stop program = "/etc/init.d/memcached stop"

check process varnish
  with pidfile /var/run/varnishd.pid
  start program = "/etc/init.d/varnish start"
  stop program = "/etc/init.d/varnish stop"
<% 0.upto((ENV['NUM_DELAYED_JOB_WORKERS'] || 1).to_i - 1) do |i| %>
check process delayed_job.<%= i %>
  with pidfile /var/run/delayed_job.<%= i %>.pid
  start program = "/app/script/delayed_job start --pid-dir=/var/run --identifier=<%= i %>"
  stop program = "/app/script/delayed_job stop --pid-dir=/var/run --identifier=<%= i %>"
<% end %>

set daemon 120
set logfile /var/log/monit.log
set idfile /var/lib/monit/id
set statefile /var/lib/monit/state
set eventqueue
  basedir /var/lib/monit/events
  slots 100

<%= ENV['MONIT_MAILSERVER'] %>

check process puma
  with pidfile /var/run/puma.pid
  start program = "/usr/local/bundle/bin/puma --config /app/docker/puma_config.rb"
  stop program = "/usr/bin/pkill --pidfile /var/run/puma.pid"

check process memcache
  with pidfile /var/run/memcached.pid
  start program = "/etc/init.d/memcached start"
  stop program = "/etc/init.d/memcached stop"

check process varnish
  with pidfile /var/run/varnishd.pid
  start program = "/etc/init.d/varnish start"
  stop program = "/etc/init.d/varnish stop"
<% 0.upto((ENV['NUM_DELAYED_JOB_WORKERS'] || 1).to_i - 1) do |i| %>
check process delayed_job.<%= i %>
  with pidfile /var/run/delayed_job.<%= i %>.pid
  start program = "/app/script/delayed_job start --pid-dir=/var/run --identifier=<%= i %>"
  stop program = "/app/script/delayed_job stop --pid-dir=/var/run --identifier=<%= i %>"
<% end %>

Set monit mailserver from environment variable.
Set monit mailserver from environment variable.
