monit-general
[Top][All Lists]
Advanced

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

Re: [monit] Start/Stop Program Calls in Monitrc


From: Martin Pala
Subject: Re: [monit] Start/Stop Program Calls in Monitrc
Date: Tue, 12 Jan 2010 08:23:22 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

On Mon, Jan 11, 2010 at 07:32:40PM -0800, bggy wrote:
> 
> Hi, I am switching to Monit from God because God leaks badly (haven't checked
> out their new release which supposedly fixes much of the leaking). To test
> out Monit I am setting it up on my dev machine (Mac OS X).
> 
> God can be configured with calls such as:
> 
> start = "starling -d -P #{RAILS_ROOT}/log/starling.pid -q #{RAILS_ROOT}/log/
> -p 22122"
> stop = "kill `cat #{RAILS_ROOT}/log/starling.pid`"
> 
> With Monit, I'm configuring monitrc with the following to start starling:
> 
> with pidfile /full/app/directory/log/starling.pid
> start program = "/usr/local/bin/starling -d -P
> /full/app/directory/log/starling.pid -q /full/app/directory/log/ -p 22122"
> 
> This works and starling starts up. But, the following call to stop starling
> doesn't work:
> 
> stop program = "/bin/kill `/bin/cat /full/app/directory/log/starling.pid`"
> 
> Is there a way to make system calls like the above in the monitrc file?


Yes, but since Monit does exec() on the program line, if you want to use shell
command line you need to wrap it in shell like this:

  stop program = "/bin/bash -c '/bin/kill `/bin/cat 
/full/app/directory/log/starling.pid`'"



> I am also unable to start workling with the following:
> 
> start program = "/full/app/directory/script/workling_client start"
> stop program = "/full/app/directory/script/workling_client stop"
> 
> My configuration to start ultrasphinx also does not work:
> 
> start program = "/usr/bin/cd /full/app/directory/ && /usr/local/bin/rake
> ultrasphinx:daemon:start"
> stop program = "/usr/bin/cd /full/app/directory/ && /usr/local/bin/rake
> ultrasphinx:daemon:stop"


Same issue - you need to wrap it in shell to get interpret shell command line:

  start program = "/bin/bash -c '/usr/bin/cd /full/app/directory/ && 
/usr/local/bin/rake ultrasphinx:daemon:start'"


Regards,
Martin





reply via email to

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