[Top][All Lists]

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

Re: [monit] Trying to run ferret without success

From: Martin Pala
Subject: Re: [monit] Trying to run ferret without success
Date: Sat, 11 Apr 2009 20:35:36 +0200
User-agent: Thunderbird (X11/20090318)

monit doesn't execute shell for start command, so if you need to call shell-like commands, you need to wrap it like this:

start program = "/bin/bash -c 'cd /var/www/tm/current/ && script/ferret_server -e production start'" as uid tm and gid tm


Bill Kocik wrote:
Hi folks -

I'm trying to get ferret under the control of monit. I start monit
from an init script, so it starts with root privileges. I need it to
run my ferret server as user "tm". The consensus on the web is that
this is the way to do that:

check process ferret with pidfile /var/www/tm/current/log/
    start program = "/bin/su -c 'cd /www/application/current/ &&
script/ferret_server start -e production' tm"
    stop program = "/bin/su -c 'cd /www/application/current/ &&
script/ferret_server stop -e production' tm"

When I try that, I get this output:

Starting monit: 'ferret' process is not running
'ferret' trying to restart
'ferret' start: /bin/su
'ferret' failed to start

That works from root's command line, but will not work with monit, and
I don't know why. I tried all manner of backslash-escaping the quotes,
to no avail. So I discovered that you can pass "uid" and "gid"
arguments to a start option, and I switched to this (I'll just show
the start line for brevity):

    start program = "cd /var/www/tm/current/ && script/ferret_server
-e production start"
        as uid tm and gid tm

That errors out complaining that there's no such command as "cd"
(which is true, it's a shell command, not a binary). If I don't change
to the right working directory, ferret refuses to start because it
can't create "log/" (and there's no way I know of to give it
a full path to where it should put its log file).

Surely there has to be a way to do this. Can I get monit to change its
working directory as part of a start directive? Is there some other
way around all this?

reply via email to

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