[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [monit] How does start/stop/restart work ?

From: Martin Pala
Subject: Re: [monit] How does start/stop/restart work ?
Date: Fri, 06 Jun 2008 19:41:50 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20080313 Iceape/1.1.9 (Debian-1.1.9-5)


Monit sets spartan environment/sandbox ... see FAQ no.6:

6. Q: I'm having trouble getting monit to execute any "start" or
      "stop" program commands.  The log file says that they're being
      executed, and I can't find anything wrong when I run monit in
      verbose mode.

   A: Monit did start the program but for some reason the service dies
      later. Before we go on and introduce you to the fine art of
      system debugging, it's worth to note that:

      For security reasons monit purges the environment and only set a
      spartan PATH variable that contains /bin, /usr/bin, /sbin and
      /usr/sbin. If your program or script dies, the reason could be
      that it expects certain environment variables or to find certain
      programs via the PATH. If this is the case you should set the
      environment variables you need directly in the start or stop
      script called by monit.

Monit's working directory when running as deamon is "/". Since your scripts use relative path to the binary, it won't be found. The same problem is with the logfile.

If you'll set absolute paths, it should work fine.


Jonathan Vanasco wrote:

I have monit configured to restart a website.

the problem is that i get 30 alerts and all failed restarts... and there seems to be no logging whatsoever of the attempt aside from 'failed' in the monit log

so i do not know why monit can restart

can anyone tell me how i can get better reporting from monit , and how the start/stop actually works?

my system requirements mean i can not have scripts in /etc - they need to go in user spaces. i'm wondering if problems have to do with my setup (below). though I can't tell because of no logging.

check process devsite
     with pidfile "/home/devsite/_current/log/"
     start program = "/home/devsite/_current/production-start"
     stop program = "/home/devsite/_current/production-kill"
     if failed port 5102 with timeout 5 seconds then restart
     if failed url  then restart
     if 5 restarts within 5 cycles then timeout
     set alert address@hidden

paster serve --pid-file=log/ --log-file=log/production.log production.ini &
    kill `cat /home/devsite/_current/log/`

To unsubscribe:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]