[Top][All Lists]

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

Re: Conditional services

From: Vadym Chepkov
Subject: Re: Conditional services
Date: Fri, 5 Feb 2016 05:17:21 -0500

It has come to my mind to have two different configs, but I was hoping monit had a more elegant solution. Thanks.


Sent from Android

On Feb 4, 2016 7:47 AM, "Phil Townes" <address@hidden> wrote:
I use two different monit configuration files. One for standby state, and one for active state.
In the event that it is determined that a standby server is to become active, the monit configuration file is overwritten with the config file for an 'active' server, and monit is reloaded.

I use a custom script for "should not be running" services in the standby state:

#! /bin/bash
# Look for a service that should be offline
ps -ef | grep -q 'my-service-name-here'

# Return an appropriate exit code
if [ $? -eq 0 ] ; then
echo "Process exists, this is a failure"
exit 1;
echo "Process does NOT exist. This is a success."
exit 0;

On 4 February 2016 at 11:52, Vadym Chepkov <address@hidden> wrote:


Can somebody give an advice how to implement active/standby configuration using monit.

There are some services which can't run from multiple locations for various reasons. To solve this problem, we have a script, which can be used to check if current location is active or standby via exit code. cron wrapper uses it to determine if cron job should run or not, for instance.

But how does one tell monit to start/monitorĀ  services if server becomes active and stop, make sure they are not running if server is in standby mode.
This should be applied only to 'volatile' services, not all of them.
Thank you.


To unsubscribe:

To unsubscribe:

reply via email to

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