You can log script output by catching the bash's output: --8<-- if does not exist then exec "/bin/bash -c '/usr/local/bin/alert $MONIT_SERVICE $MONIT_EVENT $MONIT_DESCRIPTION && /usr/local/bin/monit restart test_processor' >/tmp/exec.out 2>&&1" --8<--
You can use normal shel debugging techniques in the shel command ('set -v', etc.)
Martin
On Oct 8, 2010, at 12:32 AM, Mark Olliver wrote: Hi Martin and others :)
Do i need the '$' sign in front of the variables? At the moment i can seem to get monit to execute my script. I have given it rull permissions, and tested running it myself and all works fine. But monit gives no errors. Monit it calling the exec line as the process is being restarted via the call. Is there a way to debug monit to find out why it has issues calling my script?
Regards
Mark
On 7 October 2010 18:41, Martin Pala <address@hidden> wrote:
Hi,
the variables which describe the event have MONIT_ prefix:
MONIT_SERVICE
MONIT_EVENT
MONIT_DESCRIPTION
The && operator is OK, but if your alert script will return error, it won't be executed.
Regards,
Martin
On Oct 7, 2010, at 1:57 PM, Mark Olliver wrote:
> Hi,
>
> Is this valid,
>
> if does not exist then
> exec "/bin/bash -c '/usr/local/bin/alert $SERVICE $EVENT $DESCRIPTION && /usr/local/bin/monit restart test_processor'"
>
> At the moment in the log i can see it says exec /bin/bash but then nothing appear to happen.I am guessing monit is having trouble running my scripts but i dont see any errors produced. Is there a way to debug this?
> Do the variables from monit get passed to the script?
>
>
> Regards
>
> Mark
-- To unsubscribe: http://lists.nongnu.org/mailman/listinfo/monit-general
|