monit-general
[Top][All Lists]
Advanced

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

Re: Monit can't restart Courier IMAP?


From: Martin Pala
Subject: Re: Monit can't restart Courier IMAP?
Date: Tue, 26 Jul 2005 09:51:35 +0200
User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)

Monit sets minimalistic environment for security reasons, the PATH for example is set to:

 PATH="/bin:/usr/bin:/sbin:/usr/sbin"

In the case that your courier-imap rc script referred to some object which is not in this path (for example under /usr/local/...), or other environment variable, then it can fail (when you run command from shell, you could have customized environment).

Solution could be to set the environment in monit's method definition or fix the rc script.

stop program = '/usr/local/bin/bash -c "PATH=$PATH:/usr/local/bin /usr/local/etc/rc.d/courier.sh stop"'

You can also add something like: 'env >> /tmp/courier_env.$$' to the rc script to see what environment you have when started from monit and what when started from shell.

Martin


Mike Jackson wrote:
I apologize in advance if this is missing critical information; I'll do my best to be thorough.

I'm running Monit 4.5.1 on a FreeBSD 5.4-STABLE box. I'm using Courier-IMAP installed from FreeBSD's ports collection, stopping/starting it with the default /usr/local/etc/rc.d scripts that the port installs. Courier starts successfully when the system loads (in other words, all the correct entries are in /etc/rc.conf), and I can run the rc.d script from the command line to stop/start/restart the service. But when Monit attempt to stop/start it, it cannot. Here's an example from /var/log/messages:

Jul 25 11:27:48 bonsai monit[42687]: 'courier-imap' failed, cannot open a connection to INET[localhost:143]
Jul 25 11:27:48 bonsai monit[42687]: 'courier-imap' trying to restart
Jul 25 11:27:48 bonsai monit[42687]: 'courier-imap' stop: /usr/local/etc/rc.d/courier-imap-imapd.sh
Jul 25 11:29:53 bonsai monit[42687]: 'courier-imap' failed to stop

The rc.d script appears to be a normal FreeBSD rc.subr script, and other similar scripts play nicely with Monit. The file permissions (0755) and ownership (root:wheel) are the same as other rc.d scripts. Any ideas?


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





reply via email to

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