I'm trying to configure Monit to run my script but it's not working.
I'm running Monit 5.3.2 from a Ubuntu 11.2 environment (it's a virtual machine, my machine actually is Windows 7), and for some reason I cannot make the "check program" to work. It always gives the error:
Warning: Program is not executable: 'scriptPath'.
Just in case, I tested by copying the example Monit has on the manual (http://mmonit.com/monit/documentation/monit.html) and created the script as the manual, as described below:
An example:
check program myscript with path "/usr/local/bin/myscript.sh"
if status != 0 then alert
Sample script for the above example (/usr/local/bin/myscript.sh
):
#!/bin/bash
echo test
exit $?
Anyway, even with those instructions, I still receive the same error message:
Warning: Program is not executable: /usr/local/bin/myscript.sh
I have no idea what can be happening. Any suggestion is very welcome.
Best Answer
As the error message says, your script file is not executable. You need to add the
x
permissions usingchmod
: