Sometimes my entire Django-based site goes into 504 gateway timeout errors, so no page can be displayed.
Is it possible to write a shell program and run it every 5 minutes to detect such errors, and restart the FastCGI process if necessary?
I currently use the command below to restart FastCGI if it crashes, but it does not work for the situation described above, because when 504 gateway errors occur, the processes still work.
ps ax | grep -v grep | grep port=8001 > /dev/null || restart_fcgi.sh
, , 504 - ( , ), . , nginx + apache + mod_wsgi - nginx - - , Apache . . nginx + fastcgi, , .
, script, , - 5XX, fastcgi. Python + httplib script, os.system script ( kill -9) .
, , supervisor . . daemontools, , root-.
, , , , , .