monit-general
[Top][All Lists]
Advanced

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

Re: [monit] Monit and BackgroundRB


From: Martin Pala
Subject: Re: [monit] Monit and BackgroundRB
Date: Sun, 21 Sep 2008 11:35:33 +0200

For security reasons monit purges the environment and only sets spartan PATH variable that contains /bin, /usr/bin, /sbin and /usr/ sbin (see monit FAQ - Q6: http://www.tildeslash.com/monit/doc/faq.php). The start program is not executed in shell - the arguments are given to execv(), thus the following construct in your configuration won't work:

--8--
start program = "/usr/bin/env PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/ local/bin HOME=/home/ramon /usr/bin/ruby /home/ramon/app/current/ script/backgroundrb start"
--8--

You have several options:

1.) you can use absolute paths in your startup script or put the PATH setting to the beginning of the script.
2.) you can wrap the start command in shell like this:
start program = "/bin/bash -c '/usr/bin/env PATH=/bin:/usr/bin:/sbin:/ usr/sbin:/usr/local/bin HOME=/home/ramon /usr/bin/ruby /home/ramon/app/ current/script/backgroundrb start'"

Martin


On Sep 21, 2008, at 11:17 AM, Ramon Miguel M. Tayag wrote:

Hi all!

I'm new to this server administration, and I got myself Deploying
Rails Apps by Prag Prog to help me out.  I've learned a great lot by
trial and error and some pulling of hair.

My problem now is I get inconsistent results.  This configuration (as
far as I know), used to work. But...

Now, I can't seem to find a way to debug what's wrong.  When I start
backgroundrb via command line, it starts fine.  When I make monit do
it, I get an "Execution failed".

If I start it from the command line, and monit still has the
backgroundrb "Execution failed" status but still monitoring it, the
status becomes "running" (since I started it from command line)
However, when I stop and start from monit, or simply restart, I get
the execution failed again.

Note: I start it with the exact same code (I copy and paste the
command from my monit) except that I add "sudo" at the beginning.

Why would it fail if I start from monit but work if I start from the
command line?

Here are my config scripts:
http://pastie.org/276608

Thanks, and hoping for a solution,
--
Ramon Tayag


--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general





reply via email to

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