monit-general
[Top][All Lists]
Advanced

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

Re: monit ignores match pattern commnad


From: Jan-Henrik Haukeland
Subject: Re: monit ignores match pattern commnad
Date: Mon, 7 Apr 2014 21:58:48 +0200

On 07 Apr 2014, at 21:34, Anthony Griffiths <address@hidden> wrote:

> it's okay I found the problem:
> the exec command is exec '/bin/bash -c /root/sendemail.sh
> this works and it's a relief.

Glad to hear it worked it out. Just a FYI, exec used by Monit is the system’s 
exec[1] which require that a script *must* start with an interpreter. Just 
chmod’ing is not enough. So your /root/sendemail.sh need to start with 
something like

#!/bin/sh
<rest of script>

If you do this, there is no need to run the script through ‘bash -c’, though 
this is fine as well.

Two other important things to mention are 1) use Monit version 5.8 because all 
previous versions of Monit axed/purged the environment while from Monit 5.8 the 
environment is also kept for scripts/programs which avoid missing environment 
related problems. 2) This FAQ entry, http://mmonit.com/wiki/Monit/FAQ#execution 
has a bit more info on how to debug if exec etc fails


1. http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html


reply via email to

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