[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [monit] Headaches with exec
From: |
Jan-Henrik Haukeland |
Subject: |
Re: [monit] Headaches with exec |
Date: |
Sun, 22 Nov 2009 18:22:46 +0100 |
I just want to chip in here and mention that a script called by exec _must_
define '#!<interpreter>' at the start of the script. For instance '#!/bin/bash"
also set the execute bit on the script. If not it will not execute.
On 22. nov. 2009, at 17.26, Brian Katz wrote:
> Thanks for confirming my thoughts Martin. I really appreciate it.
>
> I'm not going to bother attaching the problematic script because it is the
> domain of the java developer. Now that he will be made to understand the
> rules, I know he will be able to modify it for monit's rules.
>
> A weight has been lifted off my shoulders. Thanks again.
>
> Any ideas why nothing about the exec appears in the log file, positive or
> negative?
>
> ----- Forwarded Message ----
> From: Martin Pala <address@hidden>
> To: This is the general mailing list for monit <address@hidden>
> Sent: Sun, November 22, 2009 2:06:26 AM
> Subject: Re: [monit] Headaches with exec
>
> See reply inlined bellow:
>
>
> On Nov 22, 2009, at 2:51 AM, Brian Katz wrote:
>
>> So after beating myself up the head for a couple of days with the exec
>> command, I have come to some conclusions and just need either correction or
>> validation.
>>
>> I'm running monit 4.10.1 under Debian and just want to use it to launch a
>> script if a checksum of a file has changed.
>>
>> When I use absolute paths after the call to exec, I get pretty consistant
>> results but strangely enough the log never tells me that it is doing the
>> exec. The logs shows that the checksum on the file changed but not that it
>> was doing the 'then' portion of the test. So for awhile I was uncertain as
>> to whether the exec command was even firing. When I put in a dead simple
>> fully qualified command in the script, it worked (if I used /bin/bash -c in
>> the command).
>>
>> I guess my question is - will absolute paths always work even if they are
>> outside the provisos of monit? (see below)
>
>
> Yes - absolute path always works, provided the user under which Monit is
> running has access to that file.
>
>
>
>>
>> For security reasons monit purges the environment and only sets a spartan
>> PATH variable that contains /bin, /usr/bin, /sbin and /usr/sbin. If your
>> program or script dies, the reason could be that it expects
>> certainenvironment variables or to find certain programs via PATH. If this
>> is the case you should set the environment variables you need directly in
>> the start or stop script called by monit.
>>
>> Can I do what ever I want in a script providing I always use absolute paths?
>
>
> You can do whatever the user which is running Monit can do.
>
>
> Please can you show part of the configuration with problematic exec?
>
>
> Thanks,
> Martin
>
>
>
>
>
>
>
>
>
> --
> To unsubscribe:
> http://lists.nongnu.org/mailman/listinfo/monit-general--
> To unsubscribe:
> http://lists.nongnu.org/mailman/listinfo/monit-general