Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm monitoring mysqld with monit but I would like that if I stop monit then the mysqld service also stops.

share|improve this question
up vote 4 down vote accepted

The easy way to do this is to modify the Monit init.d script to also stop mysqld. The main problem with this is that future updates to the Monit package may overwrite your changes.

Alternatively, you could write your own init.d script that controls mysqld and monit, and use that instead of the provided init.d scripts.

share|improve this answer

You fundamentally can't, and shouldn't want to, because that's not the way monit is designed to work. Monit is, as the name suggests, a monitoring system, that has some automatic problem-handling logic built-in. I also can't imagine why you'd want to do something like this, so I'm at a loss to give you alternative solutions to your actual problem.

share|improve this answer

This might be a a bit simplistic, but have you thought about this:

create a script that just stops/starts both services at the same time, and use that to call them instead of the regular init.d scripts?

You could put them into your bin folder if you want to be able to run them as a command.

share|improve this answer

Is it because you want to stop MySQL and do maintenance or whatever?

If so, just:

'monit unmonitor name_of_service_check_here'

... and monit will leave it be. If you have configured a monit state file (defaults to /var/.monit_state or something), then monit remembers unmonitors and such even after a reboot. You might also want to try the monit status to see current status for all or one given check:

monit status

Like Womble said, start by explaining what problem you have instead of focusing on one (probably bad) work-around.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.