WebFaction
Community site: login faq

I'm using supervisor to monitor gunicorn. I'm aware that if supervisor stops working gunicorn stops get monitored. A possible solution is to invoke from the crontab a script to monitor and eventually re/start supervisor.

I'd really appreciate some example code on how a such script could be implemented.

asked 30 Sep '12, 15:09

Guandalino
3711318
accept rate: 0%


You could write a small script and execute that via cron.

Something like:

#!/bin/bash
if ps -u <username> |grep -E '<process_name>$' > /dev/null
then
  echo "<process_name> is running."
else
  echo "starting <process>."
  <enter the command to start your process here>
fi
permanent link

answered 30 Sep '12, 15:26

bmeyer71 ♦♦
1.5k3613
accept rate: 33%

Thank you. Do you suggest to monitor supervisor or getting rid of supervisor and monitor gunicorn directly (and why)?

(30 Sep '12, 15:41) Guandalino

That's more of a personal and/or design preference. If that is what you are used to using, then there is no reason to change.

(30 Sep '12, 15:47) bmeyer71 ♦♦

It probably a matter of memory consumption, too. I read somewhere that supervisor can eat some memory on and off.

(30 Sep '12, 15:51) Guandalino

Yes, that will be something to consider as well. It may be a bit of trial and error to get what works best for you.

(30 Sep '12, 15:55) bmeyer71 ♦♦

There is a Q/A on serverfault about this choice. http://serverfault.com/a/433480/54680

(30 Sep '12, 17:32) Guandalino
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×25
×17
×12
×9
×8

question asked: 30 Sep '12, 15:09

question was seen: 4,183 times

last updated: 30 Sep '12, 17:32

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM