WebFaction
Community site: login faq

I am trying to find a solution for ensuring supervisord is always running, eg after the server is restarted

I found the instructions here http://community.webfaction.com/questions/2192/djcelery-do-start-with-django

But I have a problem... this starts supervisord ok, but the supervised process dies with these errors:

2013-03-17 21:33:09,414 INFO spawned: 'myprog' with pid 13804
2013-03-17 21:33:09,729 INFO exited: myprog (exit status 1; not expected)
2013-03-17 21:33:10,731 INFO gave up: myprog entered FATAL state, too many start retries too quickly

I have a line like this in my crontab -e

3,8,13,18,23,28,33,38,43,48,53,58 * * * * ~/conf/start_supervisor.sh >/dev/null 2>> ~/mylogs/start_supervisor.log

So, like I said this runs and starts supervisord but the supervised process fails. However if I run the command above manually ie

~/conf/start_supervisor.sh >/dev/null 2>> ~/mylogs/start_supervisor.log

...then supervisord starts and the supervised process works!

Obviously something is different about running from crontab - can anyone help please?

asked 17 Mar '13, 16:51

anentropic
81710
accept rate: 0%

edited 17 Mar '13, 16:53


Cron jobs run with a very minimal environment compared to that of an interactive shell:

SHELL=/bin/sh
MAILTO=
USER=your_username
PATH=/usr/bin:/bin
PWD=/home/your_username
SHLVL=1
HOME=/home/your_username
LOGNAME=your_username
MAILFROM=root@web317.webfaction.com
_=/usr/bin/env

If your supervised process relies on any environment variables that are missing or different from what you see above, then you'll need to explicitly set them somewhere, either in your supervisord configuration, in your crontab, or in your start_supervisor.sh script itself.

permanent link

answered 18 Mar '13, 16:45

seanf
12.2k41836
accept rate: 37%

thanks, yes in the end I solved the problem by echo $PATH in the shell and copy and pasting the output into the top of the crontab as PATH=....

if anyone has a way to do this without copy and pasting or other hard-coding I'd love to know

(18 Mar '13, 17:18) anentropic

Try wrapping the command in parenthesis,

3,8,13,18,23,28,33,38,43,48,53,58 * * * * (~/conf/start_supervisor.sh >/dev/null 2>> ~/mylogs/start_supervisor.log)
permanent link

answered 17 Mar '13, 21:27

johns
5.3k312
accept rate: 23%

thanks, this didn't fix it though

(18 Mar '13, 06:44) anentropic
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:

×50
×5

question asked: 17 Mar '13, 16:51

question was seen: 5,471 times

last updated: 18 Mar '13, 17:18

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