P
P
Printip2016-02-25 18:45:24
Nginx
Printip, 2016-02-25 18:45:24

How to auto-restart Apache in the presence of 502nd and 504th errors?

How to auto-restart Apache in the presence of 502nd and 504th errors?
When an error 502 pops up on the site, 504 to give the command to restart Apache.
I've looked all over the internet and can't find it. Axis FreeBSD
PS if apache completely dies, then there is another script that will start it.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
AntonMZ, 2016-02-25
@AntonMZ

Make a bash script with a curl request to the site. Get the header, parse the response code, and based on this, either restart or do nothing. Script in cron once per minute.

A
Andrey, 2016-02-25
@VladimirAndreev

bash which reads the error log.
as soon as it finds traces of 502 or 504 errors there, Apache restarts.

S
shuraosipov, 2016-02-25
@shuraosipov

as an example - https://gist.github.com/xi4oh4o/4378447

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question