Answer the question
In order to leave comments, you need to log in
How to restart UBUNTU SERVER when Apache and MySQL crash??
Good afternoon. I work in a government institution, there is a site with normal traffic, written in a SELF-WRITTEN framework, which means that there are no people who wrote it for a long time, NO DOCUMENTATION, the implementation of the MVC model on each page of the site is done differently (and this happens). That is, people came, practiced and left, and we rake.
A new site is in the future, but like any budget organization, this will all drag on for a VERY long time.
The site is now on NGINX+APACHE+MYSQL+UBUNTU SERVER 12.10
Periodically this site crashes with logs:
1) Cannot connect to MySQL framework error
2) APACHE crashed
I understand that it is necessary to look for the cause, and not to treat the consequences, but there is no adequate programmer in the shat, and it is very difficult to delve into self-written crutches and it is not a fact that there will be a result.
Question: is there any script that, according to the state of the Apache or MySQL services, will
1) either write letters to the administrator so that it is rebooted
2) It is better that the server itself sends to reboot
The situation is complicated by the fact that the server is working, the distribution is old, I install the software I don’t risk it with dependencies, because who and how set it up, and on what sidelines the dependencies for this self-written framework are written there, even the one who once did it does not know.
Please help.
Answer the question
In order to leave comments, you need to log in
The good thing is to write a single function that feeds multiple objects containing lists, like:
var img = '';
var src = '';
observe([img,src]);
function observe(objects){
objects.each(function(){
//blah blah blah
});
}
const lazyLoad = (Selector) =>{
const images = document.querySelectorAll(Selector);
const options = {
root: null,
rootMargin: '0px',
threshold: 0.1
}
}
......
lazyLoad('img');
lazyLoad('source');
written in a SELF-WRITTEN framework, which means that there are no people who wrote it for a long time, NO DOCUMENTATION
#!/bin/sh
if [ `ps aux | grep mysqld | grep -v grep | wc -l` -lt 1 ]
then
service mysqld restart
fi
Good article on this topic:
https://www.digitalocean.com/community/tutorials/h...
https://www.digitalocean.com/community/tutorials/h...
Plus another solution:
https:// serverfault.com/questions/252137/how-to-au...
If you have systemd, then correct the configs for mysql and apache in accordance with this article
https://jonarcher.info/2015/08/ensure-systemd-serv...
Systemd will make sure that the services are restarted when it crashes.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question