login community 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 Sep 30 '12 at 15:09

Guandalino's gravatar image

Guandalino
3719


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

Something like:

1
2
3
4
5
6
7
8
#!/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

answered Sep 30 '12 at 15:26

bmeyer71's gravatar image

bmeyer71 ♦♦
8512310

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

(Sep 30 '12 at 15:41) Guandalino Guandalino's gravatar image

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.

(Sep 30 '12 at 15:47) bmeyer71 ♦♦ bmeyer71's gravatar image

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

(Sep 30 '12 at 15:51) Guandalino Guandalino's gravatar image

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.

(Sep 30 '12 at 15:55) bmeyer71 ♦♦ bmeyer71's gravatar image

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

(Sep 30 '12 at 17:32) Guandalino Guandalino's gravatar image
Your answer
If you have an answer to the above question, then use the form below. Otherwise, use the appropriate 'add new comment' button above to post your feedback.
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

Tags:

×16
×10
×9
×5
×3

Asked: Sep 30 '12 at 15:09

Seen: 614 times

Last updated: Sep 30 '12 at 17:32

Plans & prices    Sign up    Why WebFaction?    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
Powered by OSQA
© Copyright 2003-2012 Swarma Limited - WebFaction is a service of Swarma Limited