[Top][All Lists]

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

Re: [monit] Character Limit in Start | Stop Program Directive?

From: Christopher Opena
Subject: Re: [monit] Character Limit in Start | Stop Program Directive?
Date: Tue, 17 Mar 2009 01:22:56 -0700

Also, I can confirm that it's most definitely not a problem with directive command length; I tried stopping Apache, which I'm also monitoring via .pid, and it failed to start that as well with a simple '/etc/init.d/httpd start'.  I checked to make sure Monit is running as root, which it is.  Problem with the environment?

On Tue, Mar 17, 2009 at 1:16 AM, Christopher Opena <address@hidden> wrote:
Oops sorry, mistake below.  The actual commands were:

# /bin/bash -c 'cd /path/to/the/script; LOCAL_VAR=my__var cd /path/to/the/script/my_script start -d'


# su - my__uid -c "/bin/bash -c 'cd /path/to/the/script; LOCAL_VAR=cd /path/to/the/script/my_script start -d'"

On Tue, Mar 17, 2009 at 1:14 AM, Christopher Opena <address@hidden> wrote:
Damien, thanks for the suggestion.  I tried the following while su'ed to root after executing your monit emulation script:

# /bin/bash -c 'cd /path/to/the/script; LOCAL_VAR=cd /path/to/the/script/my_script start -d'

The above failed with the message '/usr/bin/env: ruby: No such file or directory' (which makes sense).  Since I'm actually doing the Start directive as uid 'my__uid', I tested it with a su while logged in as root:

# su - my__uid -c "/bin/bash -c 'cd /path/to/the/script; LOCAL_VAR=cd /path/to/the/script/my_script start -d'"

The above worked just fine.  Are you thinking that perhaps executing the directive with the 'as uid my__uid and gid my__gid' is not working properly?

Thanks again,

On Mon, Mar 16, 2009 at 1:00 PM, Damien Bargiacchi <address@hidden> wrote:
Start up a bash session as the user that runs monit (usually root).
Run the next little one liner. It sets up the environment to emulate monit.
  for var in `env|cut -d '=' -f1`; do unset $var; done;export
Now copy-paste the start directive.

Does that still work?


On Sun, Mar 15, 2009 at 11:50 PM, Christopher Opena
<address@hidden> wrote:
> Hello all, I've been doing some fairly intensive testing of using monit to
> test out multiple applications on my server.  Each of the specific services
> I'm monitoring uses a "/bin/bash -c '/path/to/script -d'" as the Start
> execution.  I've noticed in testing that when I stop one of the services, it
> starts up automatically.  The other one doesn't.  The monit log shows it
> attempting to start the service, but it fails.  I've double- and
> triple-checked the Start directive to make sure that I didn't make any
> syntax errors, and even copied the contents of the failing Start directive
> out into my bash session (that works fine).  The only difference I can see
> is that the path to the failing script is very long.
> Is there a character limit of some kind on the Start directive that I'm not
> aware of?  I tried checking the Monit manual and it doesn't mention any
> character limit of any kind.  Below I'm pasting the contents of the two
> Start scripts (with directories in Xs just so you can see the script length
> without revealing too much).
> --Successful Script--
> start program = "/bin/bash -c 'cd /xxx/xxxxx/xxx/xxxxxxx;
> LOCAL_VAR=xxxxxxxxxx /xxx/xxxxx/xxx/xxxxxxx/xxxxxx/xxx start -d'" as uid
> my__uid and gid my__gid with timeout 60 seconds
> --Failing Script--
> start program = "/bin/bash -c 'cd
> /xxx/xxxxx/xxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxx; LOCAL_VAR=xxxxxxxxxx
> /xxx/xxxxx/xxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxx/xxx start -d'" as uid my__uid
> and gid my__gid with timeout 60 seconds
> I've also checked to make sure that directory ownership was the same on the
> two different log directories that the scripts write to - no problems
> there.  I'm quite at my wits end to determine why one works and the other
> one doesn't - and they starting the exact same script for different apps on
> the same server!  Any help would be greatly appreciated.
> Thanks,
> -Chris.
> --
> To unsubscribe:

To unsubscribe:

reply via email to

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