On 07 Apr 2014, at 21:34, Anthony Griffiths <[email protected]> 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
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to