Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 know you can do monit start <name> to start an individual process (eg if I had taken it down temporarily using monit stop <name>), but is there any easy way to tell it to only start the new process if the pid in the pidfile isn't running? Or do I have to make this part of whatever script monit uses to start the process if I want that kind of behavior?

share|improve this question
The system's commands for managing daemons should be set up so that if you try to start something that is already running nothing happens. Is that broken for you? – vonbrand Feb 27 '13 at 13:25
I've written a daemon from scratch that does not on its own take care of that, my question is do I need to, or is there some kind of system command to take care of that for me? Sorry, total newbie! – Mohamed Hafez Feb 27 '13 at 16:46
up vote 0 down vote accepted

Found the answer I was looking for: use start-stop-daemon to start and stop the daemon, and all the pidfile management, not restarting if its already running, and killing the daemon if it doesn't die on its own after sending it TERM, etc, will be taken care of according to the parameters you pass.

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.