[Top][All Lists]
[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 21:43:56 +0100 |
The environment cleanup is done for security reasons to not dispose unwanted
informations to executed program/script and the PATH is reset for the same
reason. Currently it is necessary to set extra required/trusted variables by
modification of the start/stop script or wrap it using shell like this:
start program = "/bin/bash -c 'HOME=/home/abc PATH=/opt/local:/bin
/my/program start'"
Regards,
Martin
On Jan 12, 2010, at 7:30 PM, bggy wrote:
>
> Thanks for the tip! It seems that the other issue I'm having with the
> workling and ultrasphinx start calls is related to Monit resetting
> environment variables. When starting ultrasphinx I get the following error
> message:
>
> couldn't find HOME environment -- expanding `~'
> /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2390:in
> `expand_path'
>
> Is there a way to run monit without it clearing env variables and resetting
> $PATH?
>
> Thank you!,
> John
>
>
> Martin Pala wrote:
>>
>> 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
>>
>>
>>
>> --
>> To unsubscribe:
>> http://lists.nongnu.org/mailman/listinfo/monit-general
>>
>>
>
> --
> View this message in context:
> http://old.nabble.com/Start-Stop-Program-Calls-in-Monitrc-tp27122007p27131347.html
> Sent from the monit-general mailing list archive at Nabble.com.
>
>
>
> --
> To unsubscribe:
> http://lists.nongnu.org/mailman/listinfo/monit-general