Starting/stopping processes occurs in serial, ergo make sure the start/stop commands go quickly or the whole thing hangs. I It's a good idea to use env.sh
scripts to setup the execution environment so you have something fully reproducible. Here is the command to get the ruby environment via rvm
.
rvm info environment | sed -n -e 's/: \{1,\}/=/' -e 's|.rvm/bin:.*|.rvm/bin:$PATH"|' -e 's/ \([A-Z]\)/export \1/p'
An example usage:
check process process_name with pidfile /path/to/pidfile.pid
start program = "/usr/bin/env -i KEY=VALUE /path/to/env.sh /path/to/monit_exec start /path/to/pidfile.pid /path/to/stdin_file /path/to/stdout_file /path/to/logfile.log commmand args..."
stop program = "/usr/bin/env -i KEY=VALUE /path/to/env.sh /path/to/monit_exec stop /path/to/pidfile.pid /dev/null /dev/null /path/to/logfile.log"
mode passive