[Top][All Lists]

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

Re: [monit] monit command line and capistrano

From: Martin Pala
Subject: Re: [monit] monit command line and capistrano
Date: Mon, 21 Jul 2008 21:56:42 +0200

You can use "set -xv" in the script to get more details, also strace/ ltrace can help to check the system/library calls.

The problem may be even with PATH variable as described in FAQ, since monit sets it to "/bin:/usr/bin:/sbin:/usr/sbin" ... if your path (env) is different, it may then some scripts may have problems when it will use non-absolute paths.


On Jul 21, 2008, at 9:48 PM, Matt Murphy wrote:


Hmm... As far as I am aware, the script does not use any environment
variables.  Do you know if there is a way to simulate starting w/o
environment variables on the command line so that I can verify this?


On Mon, Jul 21, 2008 at 12:10 PM, Martin Pala <address@hidden> wrote:
This is most probably caused by missing environment variable. Monit sets
spartan environment/sandbox when starting services.

Here is FAQ item regarding short description from FAQ

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.

It's possible that your scripts need some environment variable which is
missing ... simply add everything what is needed to your scripts.


Matt Murphy wrote:


I'm trying to use monit to control some services, and all are working
fine except thin (web server).

Oddly, when I do a fresh deploy with Capistrano, using monit to stop
and start the thin webserver seems not to work.  The process age
continues to increment whereas the other processes show 0 seconds of
uptime and begin counting again after the deploy.

I've tried a variety of start and stop commands, and have finally
resorted to having capistrano use  "/usr/bin/thin stop -P
/path/to/pidfile -c /path/to/app".  When I had this as the stop
command in monit, thin would not stop reliably (maybe about 1 in 10
times) on deploy.

In case you're not familiar with Capistrano, it's just a deployment
automation utility that executes shell commands remotely.  In this
case it's executing: sudo monit stop thin9000 (but failing to make it
stop even though monitrc has the stop command as above).

Not sure if there are any thin users on this list but I thought I'd
ask generally what I might do to debug this further (tailing syslog
doesn't seem to reveal anything useful).

thanks in advance!

To unsubscribe:

To unsubscribe:

To unsubscribe:

reply via email to

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