[Top][All Lists]

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

Re: [monit] problems with exec action

From: Jan-Henrik Haukeland
Subject: Re: [monit] problems with exec action
Date: Fri, 14 Dec 2007 11:47:56 +0100

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
        if failed url
        and content == 'MM_preloadImages'
        then exec "/usr/local/sbin/tomcat-restart"

reply via email to

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