I am still having issues getting monit to run a script. If it the script via the same command on the command line then it works.
address@hidden monit.d]# /bin/bash -xvc '/usr/local/bin/alert $MONIT_SERVICE $MONIT_EVENT $MONIT_DESCRIPTION' >/tmp/exec.out 2>&1
address@hidden monit.d]# more /tmp/exec.out
/usr/local/bin/alert $MONIT_SERVICE $MONIT_EVENT $MONIT_DESCRIPTION
+ /usr/local/bin/alert
OK 100093
address@hidden monit.d]# ls -l /usr/local/bin/alert
-rwxr-xr-x 1 root root 1783 Oct 7 23:26 /usr/local/bin/alert
If however, i try the same from monit it fails to run the alert script and no output is placed into /tmp/exec.out.
check process test_processor
with pidfile "/var/run/test_processor.pid"
start program = "/etc/init.d/web_start -p /var/run/test_processor.pid"
as uid nobody and gid nobody
stop program = "/bin/bash -c 'kill -TERM `cat /var/run/test_processor.pid`'"
if failed host 127.0.0.1 port 32698 then
exec "/bin/bash -xvc '/usr/local/bin/alert $MONIT_SERVICE $MONIT_EVENT $MONIT_DESCRIPTION' >/tmp/exec.out 2>&1 /tmp/exec1.out"
if does not exist then
exec "/bin/bash -xvc '/usr/local/bin/alert $MONIT_SERVICE $MONIT_EVENT $MONIT_DESCRIPTION' >/tmp/exec.out 2>&1 /tmp/exec1.out"
if 5 restarts within 5 cycles then unmonitor
mode active
Do you have any ideas where i am wrong on this command. I am using monit version 5.2.1