I am looking for a process manager daemon/service which can be used to start, monitor and stop various processes.

I have seen the likes of

However, from a brief perusal of their documentation, I don't believe there is a way to schedule start and stop times.

I am looking for something which will monitor a service and ensure it is running, restart it if it exits early, do stdout/stderr redirection to a log file etc etc, but only during a scheduled time window.

Any suggestions?


1 Answer 1


You can write a supervisor script which checks to see if your process is running and if it isn't (re)starts it then schedule your supervisor script to run periodically between start and end times using cron. Then you can have a terminator script which ends your process, (if it is still running), just after your supervisor scripts last run.

All of this can be done with a little thought and with bash or python and cron.

  • If I want it to be restarted immediately if it dies, then I would have to poll it's state rapidly, which would cause overhead. It should be event driven, not use active polling. Jun 10, 2015 at 6:16
  • If you start your task using pythons subprocess library you can check if it has finished and restart if it is before the end time. You could also use psutil to check that a spawned task is running. You can only use event driven if the process raises an event on termination - what happens if your task gets stuck btw. Jun 10, 2015 at 6:22
  • supervisord starts the program as a subprocess. It sounds like you're advocating replicating the behaviour of supervisord, rather than augmenting it with the additional time-based start/stop behaviour Jun 10, 2015 at 6:26
  • I was suggesting that you might not need supervisord at all but if you wish to use that and start/stop it with a cron event that should also work reasonably well. Jun 10, 2015 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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