I'm trying to use Monit to monitor and restart some rails apps when they crash. The apps use Sphinx. Monit isnt accepting commands that would typically work in the shell.
The monitrc configuration looks something like this:
...
check process app_name
with pidfile "/path/to/pidfile/searchd.production.pidfile"
start program = sudo su user_name -c "cd /home/app_name/current
&& RAILS_ENV=production rake ts:start"
stop program = sudo su user_name -c "cd /home/app_name/current
&& RAILS_ENV=production rake ts:stop"
...
permission to access the pidfile is denied but if I try:
with pidfile "sudo /path/to/pidfile/searchd.production.pidfile"
it doesnt work.
likewise, monit doesnt accept the start and stop program bash commands.
Is there an obvious workaround I'm missing? I'm a noob by the way.
I also had a look at http://capitate.rubyforge.org/recipes/sphinx-monit.html#sphinx:monit:start but don't really get it.