2

I've got monit running on a linux vserver, installed in a custom location

/home/user/bin/monit

as that is the only suitable location according to the webhost providers. When I installed monit I used ./configure --prefix=/home/user

Monit itself runs, and sends me emails of it's activity, and the control file syntax is correct. However, monit cannot seem to start or stop anything - or even run the simplest of scripts. eg. Using 'monit stop all', I try to run the following stop command

stop = "/bin/bash /home/user/simple_script.sh"

Which fails (and says so in the log). I cant figure out why this is failing, can anyone help with this?

2

We use monit talso, and we have something like that in our scripts:

check process cron with pidfile /var/run/crond.pid
    start program = "/etc/init.d/cron start"
    stop  program = "/etc/init.d/cron stop"
    group system
    depends cron_init, cron_bin

check file cron_init with path /etc/init.d/cron
    group system

check file cron_bin with path /usr/sbin/cron
    group system

Can you show us monit logs?

2

Is monit running as root? If it isn't, it may not have the appropriate permissions to make these changes. Quick and dirty way to check is ps aux | grep monit

1

Is simple_script.sh what monit is also starting? The stop needs to be an actual command that is used to stop the command from running, not just the name of the script itself.

  • I figured that the monit start/stop directives will try and run any command, so have just created simple_script which write a date into a file (which i can check to see if its run).. In a way I'm trying to isolate the problem, as I figure if it can reach that file and run it, then I can work up from that. Maybe I'm misunderstanding something though? – Vaughan Magnusson Aug 16 '09 at 23:04
  • In this case, the stop command needs to be what command specifically monit needs to issue to stop the process from running. – ctennis Aug 16 '09 at 23:12
  • 1
    I appreciate your help, however the problem is that I cannot run anything I put in the start/stop directives - everything I've tried gives me a 'failed to start' message. The actual command I want to run is "/usr/bin/ruby /home/user/site/script/backgroundrb stop", but for now I'd be happy with a 'hello world' – Vaughan Magnusson Aug 16 '09 at 23:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy