I suspect that the tomcat-restart script refuse to run because it expect some environment variables it cant find. Maybe JAVA_HOME and stuff like that. When monit execute a script, it purge the environment and only sets a very spartan PATH. So you must make sure that you set and export all environment variables yourself in the tomcat-restart script or in a wrapper script that calls tomcat-restart. (If you search the mailing list archive you may find a hint since this has been discussed before.)

With regards to "/bin/date >> /var/monit.log" this wont work since monit does not execute a shell. It takes the first argument given to exec as the program to execute and the rest as arguments to the program. However you can start a script in exec, and this will work "/ bin/bash -c '/bin/date >> /var/monit.log'

Best regards
--
Jan-Henrik Haukeland


On Dec 14, 2007, at 8:49 AM, Benjamin Engle wrote:

The below configuration detect my website failures perfect but it never runs the exec. I have tried to put commands directly in the quotes with no success either "/bin/date >> /var/monit.log"

I'm new to monit. Can someone please tell me what's wrong here? Thank you

check host shorthostname with address xxx.xxx.xxx.xxx
        if failed url
        http://somewebserver/folder/index.jsp
        and content == 'MM_preloadImages'
        then exec "/usr/local/sbin/tomcat-restart"

--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to