monit-general
[Top][All Lists]
Advanced

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

Re: start/stop command and "cd"


From: Josh Sharpe
Subject: Re: start/stop command and "cd"
Date: Wed, 20 Oct 2010 10:15:24 -0400

Thanks Eric, Rory,


So this works...
start program = "/bin/bash -c 'cd /some/path; VAR=blah rake ts:start'"

Which is 90% of the problem.  The other 10% is that rake should really be executed as another user, not root.

So I tried this:

start program = "/bin/bash -c 'su - some_user -c \'cd /some/path; VAR=blah rake ts:start\''"

This parses fine - so I can start monit and check its status.  But the command doesn't work.  It continually fails.

Executing this in my shell directly as root works just fine

/bin/bash -c "su - some_user -c 'cd /some/path; VAR=blah rake ts:start'"

...so there's some issue converting it and putting it in a monit config.

Any ideas for that?

On Wed, Oct 20, 2010 at 3:11 AM, Eric Pailleau <address@hidden> wrote:
Le 20/10/2010 03:48, rory a écrit :

 On 10/19/10 6:43 PM, Josh Sharpe wrote:
If my start cmd looks like this:

start program = "cd some_path; some_command"

I get this error:

the executable does not exist 'cd'


hello,
It seems that monit need the first term be a valid path to an executable.
As execs comes without any PATH environnement, you certainly need to
give an absolute path to it.
The problem here is that 'cd' is not a program but a shell term, like 'for' or any other shell statements.
You found it by yourself.

Regards


reply via email to

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